ClickHouse/src/Loggers/Loggers.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

42 lines
1.0 KiB
C++
Raw Normal View History

2020-10-10 18:37:02 +00:00
#pragma once
#include <optional>
#include <string>
#include <Poco/AutoPtr.h>
#include <Poco/FileChannel.h>
#include <Poco/Util/Application.h>
2019-07-30 14:04:18 +00:00
#include "OwnSplitChannel.h"
2021-05-04 17:43:23 +00:00
namespace Poco::Util
{
2019-09-03 19:48:29 +00:00
class AbstractConfiguration;
}
class Loggers
{
public:
void buildLoggers(Poco::Util::AbstractConfiguration & config, Poco::Logger & logger, const std::string & cmd_name = "");
2021-09-30 19:46:12 +00:00
void updateLevels(Poco::Util::AbstractConfiguration & config, Poco::Logger & logger);
2019-06-14 15:49:38 +00:00
/// Close log files. On next log write files will be reopened.
void closeLogs(Poco::Logger & logger);
2024-05-22 11:18:51 +00:00
virtual ~Loggers() = default;
protected:
virtual bool allowTextLog() const { return true; }
2019-07-30 14:04:18 +00:00
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::optional<std::string> config_logger;
2019-07-30 14:04:18 +00:00
2019-07-30 14:04:18 +00:00
Poco::AutoPtr<DB::OwnSplitChannel> split;
};