ClickHouse/libs/libloggers/loggers/Loggers.h

41 lines
1.1 KiB
C++
Raw Normal View History

#include <optional>
#include <string>
#include <Poco/AutoPtr.h>
#include <Poco/FileChannel.h>
#include <Poco/Util/Application.h>
2019-06-20 07:17:21 +00:00
#include <Common/SensitiveDataMasker.h>
#include "OwnFormattingChannel.h"
namespace Poco::Util
{
class AbstractConfiguration;
}
class Loggers
{
public:
void buildLoggers(Poco::Util::AbstractConfiguration & config, Poco::Logger & logger, const std::string & cmd_name = "");
2019-06-20 07:17:21 +00:00
void setLoggerSensitiveDataMasker(Poco::Logger & logger, DB::SensitiveDataMasker * sensitive_data_masker);
2019-06-14 15:49:38 +00:00
/// Close log files. On next log write files will be reopened.
void closeLogs(Poco::Logger & logger);
std::optional<size_t> getLayer() const
{
2019-06-14 15:49:38 +00:00
return layer; /// layer setted in inheritor class BaseDaemonApplication.
}
protected:
std::optional<size_t> layer;
private:
Poco::AutoPtr<Poco::FileChannel> log_file;
Poco::AutoPtr<Poco::FileChannel> error_log_file;
Poco::AutoPtr<Poco::Channel> syslog_channel;
2019-06-20 07:17:21 +00:00
/// Previous value of logger element in config. It is used to reinitialize loggers whenever the value changed.
std::string config_logger;
};