diff --git a/ydb/core/base/logoblob.cpp b/ydb/core/base/logoblob.cpp index d5deb4b75af5..385c0a3aa14d 100644 --- a/ydb/core/base/logoblob.cpp +++ b/ydb/core/base/logoblob.cpp @@ -1,35 +1,26 @@ #include "logoblob.h" #include -#include namespace NKikimr { TString TLogoBlobID::ToString() const { - return Sprintf( - "[%" PRIu64 ":%" PRIu32 ":%" PRIu32 ":%" PRIu32 ":%" PRIu32 ":%" PRIu32 ":%" PRIu32 "]", - TabletID(), - Generation(), - Step(), - Channel(), - Cookie(), - BlobSize(), - PartId()).data(); + TString str; + str.reserve(64); + TStringOutput outStr(str); + Out(outStr); + return str; } void TLogoBlobID::Out(IOutputStream &o) const { - char buf[240]; - snprintf(buf, sizeof(buf), - "[%" PRIu64 ":%" PRIu32 ":%" PRIu32 ":%" PRIu32 ":%" PRIu32 ":%" PRIu32 ":%" PRIu32 "]", - TabletID(), - Generation(), - Step(), - Channel(), - Cookie(), - BlobSize(), - PartId() - ); - - o << buf; + o << '[' + << TabletID() << ':' + << Generation() << ':' + << Step() << ':' + << Channel() << ':' + << Cookie() << ':' + << BlobSize() << ':' + << PartId() + << ']' ; } void TLogoBlobID::Out(IOutputStream &o, const TVector &vec) { diff --git a/ydb/core/base/traceid.cpp b/ydb/core/base/traceid.cpp index 23311ea0d1cc..af3cace92f25 100644 --- a/ydb/core/base/traceid.cpp +++ b/ydb/core/base/traceid.cpp @@ -20,16 +20,15 @@ TTraceID TTraceID::GenerateNew() { } TString TTraceID::ToString() const { - TString result; - TStringOutput out(result); - Out(out); - return result; + TString str; + str.reserve(128); + TStringOutput outStr(str); + Out(outStr); + return str; } void TTraceID::Out(IOutputStream &o) const { - char buf[240]; - snprintf(buf, sizeof(buf), "[ID:%" PRIu64 ", Created: %s]", RandomID, TInstant::MicroSeconds(CreationTime).ToRfc822StringLocal().data()); - o << buf; + o << "[ID: " << RandomID << ", " << "Created: " << TInstant::MicroSeconds(CreationTime).ToRfc822StringLocal() << "]"; } bool TTraceID::operator<(const TTraceID &x) const {