diff options
author | nadya73 <nadya73@yandex-team.com> | 2023-09-18 11:23:56 +0300 |
---|---|---|
committer | nadya73 <nadya73@yandex-team.com> | 2023-09-18 11:44:51 +0300 |
commit | 1ea7c16853065f6a06898d51654b019706f8bbb1 (patch) | |
tree | 779ef2090de559671ac2786bc0fe0bb8220cb5d6 | |
parent | bd8af5e1da8f75253ea773968006bb9c49137c90 (diff) | |
download | ydb-1ea7c16853065f6a06898d51654b019706f8bbb1.tar.gz |
Snake case for structured plain_text logs
-rw-r--r-- | yt/yt/core/logging/formatter.cpp | 6 | ||||
-rw-r--r-- | yt/yt/core/logging/unittests/logging_ut.cpp | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/yt/yt/core/logging/formatter.cpp b/yt/yt/core/logging/formatter.cpp index 701f8a87c5..fa982ad8f5 100644 --- a/yt/yt/core/logging/formatter.cpp +++ b/yt/yt/core/logging/formatter.cpp @@ -187,14 +187,14 @@ i64 TStructuredLogFormatter::WriteFormatted(IOutputStream* stream, const TLogEve .Item("category").Value(event.Category->Name) .DoIf(event.Family == ELogFamily::PlainText, [&] (auto fluent) { if (event.FiberId != TFiberId()) { - fluent.Item("fiberId").Value(Format("%x", event.FiberId)); + fluent.Item("fiber_id").Value(Format("%x", event.FiberId)); } if (event.TraceId != TTraceId()) { - fluent.Item("traceId").Value(event.TraceId); + fluent.Item("trace_id").Value(event.TraceId); } if (EnableSourceLocation_ && event.SourceFile) { auto sourceFile = event.SourceFile; - fluent.Item("sourceFile").Value(Format("%v:%v", sourceFile.RNextTok(LOCSLASH_C), event.SourceLine)); + fluent.Item("source_file").Value(Format("%v:%v", sourceFile.RNextTok(LOCSLASH_C), event.SourceLine)); } }) .EndMap(); diff --git a/yt/yt/core/logging/unittests/logging_ut.cpp b/yt/yt/core/logging/unittests/logging_ut.cpp index 20e1eb128e..2337d0d7a8 100644 --- a/yt/yt/core/logging/unittests/logging_ut.cpp +++ b/yt/yt/core/logging/unittests/logging_ut.cpp @@ -539,13 +539,13 @@ TEST_F(TLoggingTest, PlainTextLoggingStructuredFormatter) EXPECT_EQ(message->GetChildOrThrow("message")->AsString()->GetValue(), "test_message"); EXPECT_EQ(message->GetChildOrThrow("level")->AsString()->GetValue(), "debug"); EXPECT_EQ(message->GetChildOrThrow("category")->AsString()->GetValue(), Logger.GetCategory()->Name); - EXPECT_EQ(message->GetChildOrThrow("fiberId")->AsString()->GetValue(), "1f"); - EXPECT_EQ(message->GetChildOrThrow("traceId")->AsString()->GetValue(), "4-3-2-1"); + EXPECT_EQ(message->GetChildOrThrow("fiber_id")->AsString()->GetValue(), "1f"); + EXPECT_EQ(message->GetChildOrThrow("trace_id")->AsString()->GetValue(), "4-3-2-1"); if (enableSourceLocation) { - EXPECT_EQ(message->GetChildOrThrow("sourceFile")->AsString()->GetValue(), "b.cpp:123"); + EXPECT_EQ(message->GetChildOrThrow("source_file")->AsString()->GetValue(), "b.cpp:123"); } else { - EXPECT_EQ(message->FindChild("sourceFile"), nullptr); + EXPECT_EQ(message->FindChild("source_file"), nullptr); } } } @@ -589,8 +589,8 @@ TEST_F(TLoggingTest, StructuredLogging) EXPECT_EQ(message->GetChildOrThrow("level")->AsString()->GetValue(), "debug"); EXPECT_EQ(message->GetChildOrThrow("category")->AsString()->GetValue(), Logger.GetCategory()->Name); - EXPECT_EQ(message->FindChild("fiberId"), nullptr); - EXPECT_EQ(message->FindChild("traceId"), nullptr); + EXPECT_EQ(message->FindChild("fiber_id"), nullptr); + EXPECT_EQ(message->FindChild("trace_id"), nullptr); } } |