aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/logger/thread_creator.cpp
blob: 7e2eaba109dec8c9476a55a99e06a032a3212136 (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
29
30
#include "thread_creator.h" 
#include "thread.h" 
 
TOwningThreadedLogBackendCreator::TOwningThreadedLogBackendCreator(THolder<ILogBackendCreator>&& slave) 
    : Slave(std::move(slave)) 
{} 
 
THolder<TLogBackend> TOwningThreadedLogBackendCreator::DoCreateLogBackend() const { 
    return MakeHolder<TOwningThreadedLogBackend>(Slave->CreateLogBackend().Release(), QueueLen, QueueOverflowCallback); 
} 
 
bool TOwningThreadedLogBackendCreator::Init(const IInitContext& ctx) { 
    ctx.GetValue("QueueLen", QueueLen); 
    return Slave->Init(ctx); 
} 
 
 
void TOwningThreadedLogBackendCreator::ToJson(NJson::TJsonValue& value) const { 
    value["QueueLen"] =  QueueLen; 
    value["Threaded"] = true; 
    Slave->ToJson(value); 
} 
 
void TOwningThreadedLogBackendCreator::SetQueueOverflowCallback(std::function<void()> callback) { 
    QueueOverflowCallback = std::move(callback); 
} 
 
void TOwningThreadedLogBackendCreator::SetQueueLen(size_t len) { 
    QueueLen = len; 
}