diff options
| author | Devtools Arcadia <[email protected]> | 2022-02-07 18:08:42 +0300 | 
|---|---|---|
| committer | Devtools Arcadia <[email protected]> | 2022-02-07 18:08:42 +0300 | 
| commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
| tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/logger/rotating_file_creator.cpp | |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/logger/rotating_file_creator.cpp')
| -rw-r--r-- | library/cpp/logger/rotating_file_creator.cpp | 28 | 
1 files changed, 28 insertions, 0 deletions
| diff --git a/library/cpp/logger/rotating_file_creator.cpp b/library/cpp/logger/rotating_file_creator.cpp new file mode 100644 index 00000000000..6f71b685736 --- /dev/null +++ b/library/cpp/logger/rotating_file_creator.cpp @@ -0,0 +1,28 @@ +#include "rotating_file_creator.h" +#include "rotating_file.h" + +THolder<TLogBackend> TRotatingFileLogBackendCreator::DoCreateLogBackend() const { +    return MakeHolder<TRotatingFileLogBackend>(Path, MaxSizeBytes, RotatedFilesCount); +} + + +TRotatingFileLogBackendCreator::TRotatingFileLogBackendCreator() +    : TFileLogBackendCreator("", "rotating") +{} + +bool TRotatingFileLogBackendCreator::Init(const IInitContext& ctx) { +    if (!TFileLogBackendCreator::Init(ctx)) { +        return false; +    } +    ctx.GetValue("MaxSizeBytes", MaxSizeBytes); +    ctx.GetValue("RotatedFilesCount", RotatedFilesCount); +    return true; +} + +ILogBackendCreator::TFactory::TRegistrator<TRotatingFileLogBackendCreator> TRotatingFileLogBackendCreator::Registrar("rotating"); + +void TRotatingFileLogBackendCreator::DoToJson(NJson::TJsonValue& value) const { +    TFileLogBackendCreator::DoToJson(value); +    value["MaxSizeBytes"] = MaxSizeBytes; +    value["RotatedFilesCount"] = RotatedFilesCount; +} | 
