aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/logger/rotating_file_creator.cpp
blob: 8b4f981b5c26fdd5a2c645e1c5650be0d7aef3e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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; 
}