summaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/interface/logging/yt_log.cpp
diff options
context:
space:
mode:
authormax42 <[email protected]>2023-06-30 11:13:34 +0300
committermax42 <[email protected]>2023-06-30 11:13:34 +0300
commit3e1899838408bbad47622007aa382bc8a2b01f87 (patch)
tree0f21c1e6add187ddb6c3ccc048a7d640ce03fb87 /yt/cpp/mapreduce/interface/logging/yt_log.cpp
parent5463eb3f5e72a86f858a3d27c886470a724ede34 (diff)
Revert "YT-19324: move YT provider to ydb/library/yql"
This reverts commit ca272f12fdd0e8d5c3e957fc87939148f1caaf72, reversing changes made to 49f8acfc8b0b5c0071b804423bcf53fda26c7c12.
Diffstat (limited to 'yt/cpp/mapreduce/interface/logging/yt_log.cpp')
-rw-r--r--yt/cpp/mapreduce/interface/logging/yt_log.cpp126
1 files changed, 0 insertions, 126 deletions
diff --git a/yt/cpp/mapreduce/interface/logging/yt_log.cpp b/yt/cpp/mapreduce/interface/logging/yt_log.cpp
deleted file mode 100644
index 9fa7b915802..00000000000
--- a/yt/cpp/mapreduce/interface/logging/yt_log.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-#include "yt_log.h"
-
-#include "logger.h"
-
-#include <util/generic/guid.h>
-
-#include <util/system/mutex.h>
-
-namespace NYT {
-
-using namespace NLogging;
-
-////////////////////////////////////////////////////////////////////////////////
-
-namespace {
-
-class TLogManager
- : public ILogManager
-{
-public:
- static constexpr TStringBuf CategoryName = "Wrapper";
-
-public:
- void RegisterStaticAnchor(
- TLoggingAnchor* anchor,
- ::TSourceLocation sourceLocation,
- TStringBuf anchorMessage) override
- {
- if (anchor->Registered.exchange(true)) {
- return;
- }
-
- anchor->Enabled.store(true);
-
- auto guard = Guard(Mutex_);
- anchor->SourceLocation = sourceLocation;
- anchor->AnchorMessage = anchorMessage;
- }
-
- void UpdateAnchor(TLoggingAnchor* /*position*/) override
- { }
-
- void Enqueue(TLogEvent&& event) override
- {
- auto message = TString(event.MessageRef.ToStringBuf());
- LogMessage(
- ToImplLevel(event.Level),
- ::TSourceLocation(event.SourceFile, event.SourceLine),
- "%.*s",
- event.MessageRef.size(),
- event.MessageRef.begin());
- }
-
- const TLoggingCategory* GetCategory(TStringBuf categoryName) override
- {
- Y_VERIFY(categoryName == CategoryName);
- return &Category_;
- }
-
- void UpdateCategory(TLoggingCategory* /*category*/) override
- {
- Y_FAIL();
- }
-
- bool GetAbortOnAlert() const override
- {
- return false;
- }
-
-private:
- static ILogger::ELevel ToImplLevel(ELogLevel level)
- {
- switch (level) {
- case ELogLevel::Minimum:
- case ELogLevel::Trace:
- case ELogLevel::Debug:
- return ILogger::ELevel::DEBUG;
- case ELogLevel::Info:
- return ILogger::ELevel::INFO;
- case ELogLevel::Warning:
- case ELogLevel::Error:
- return ILogger::ELevel::ERROR;
- case ELogLevel::Alert:
- case ELogLevel::Fatal:
- case ELogLevel::Maximum:
- return ILogger::ELevel::FATAL;
- }
- }
-
- static void LogMessage(ILogger::ELevel level, const ::TSourceLocation& sourceLocation, const char* format, ...)
- {
- va_list args;
- va_start(args, format);
- GetLogger()->Log(level, sourceLocation, format, args);
- va_end(args);
- }
-
-private:
- ::TMutex Mutex_;
- std::atomic<int> ActualVersion_{1};
- const TLoggingCategory Category_{
- .Name{CategoryName},
- .MinPlainTextLevel{ELogLevel::Minimum},
- .CurrentVersion{1},
- .ActualVersion = &ActualVersion_,
- };
-};
-
-TLogManager LogManager;
-
-} // namespace
-
-////////////////////////////////////////////////////////////////////////////////
-
-TLogger Logger(&LogManager, TLogManager::CategoryName);
-
-////////////////////////////////////////////////////////////////////////////////
-
-void FormatValue(TStringBuilderBase* builder, const TGUID& value, TStringBuf /*format*/)
-{
- builder->AppendString(GetGuidAsString(value));
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-} // namespace NYT