aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/logger/thread_creator.h
blob: 9e5ee9571d71e299af787c566e659d8738cb9768 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma once

#include "backend_creator.h"

#include <functional>

class TOwningThreadedLogBackendCreator: public ILogBackendCreator {
public:
    TOwningThreadedLogBackendCreator(THolder<ILogBackendCreator>&& slave);
    virtual bool Init(const IInitContext& ctx) override;
    virtual void ToJson(NJson::TJsonValue& value) const override;
    void SetQueueOverflowCallback(std::function<void()> callback);
    void SetQueueLen(size_t len);

private:
    virtual THolder<TLogBackend> DoCreateLogBackend() const override;
    THolder<ILogBackendCreator> Slave;
    std::function<void()> QueueOverflowCallback = {};
    size_t QueueLen = 0;
};