mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 05:32:52 +00:00
526afd44ed
Among other things, it is used to filter logs, which are being written even after the global server context is deinitialized, so we can't keep masker there.
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#include <optional>
|
|
#include <string>
|
|
#include <Poco/AutoPtr.h>
|
|
#include <Poco/FileChannel.h>
|
|
#include <Poco/Util/Application.h>
|
|
#include <Interpreters/TextLog.h>
|
|
#include "OwnSplitChannel.h"
|
|
|
|
namespace Poco::Util
|
|
{
|
|
class AbstractConfiguration;
|
|
}
|
|
|
|
class Loggers
|
|
{
|
|
public:
|
|
void buildLoggers(Poco::Util::AbstractConfiguration & config, Poco::Logger & logger, const std::string & cmd_name = "");
|
|
|
|
/// Close log files. On next log write files will be reopened.
|
|
void closeLogs(Poco::Logger & logger);
|
|
|
|
std::optional<size_t> getLayer() const
|
|
{
|
|
return layer; /// layer setted in inheritor class BaseDaemonApplication.
|
|
}
|
|
|
|
void setTextLog(std::shared_ptr<DB::TextLog> log);
|
|
|
|
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;
|
|
|
|
/// Previous value of logger element in config. It is used to reinitialize loggers whenever the value changed.
|
|
std::string config_logger;
|
|
|
|
std::weak_ptr<DB::TextLog> text_log;
|
|
Poco::AutoPtr<DB::OwnSplitChannel> split;
|
|
};
|