2020-10-10 18:37:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-06-14 14:00:37 +00:00
|
|
|
#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"
|
2019-06-14 14:00:37 +00:00
|
|
|
|
2022-03-03 20:27:46 +00:00
|
|
|
#ifdef WITH_TEXT_LOG
|
2022-01-17 04:33:47 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
class TextLog;
|
|
|
|
}
|
2022-03-03 20:27:46 +00:00
|
|
|
#endif
|
2021-05-04 17:43:23 +00:00
|
|
|
|
2019-06-14 14:00:37 +00:00
|
|
|
namespace Poco::Util
|
|
|
|
{
|
2019-09-03 19:48:29 +00:00
|
|
|
class AbstractConfiguration;
|
|
|
|
}
|
|
|
|
|
2019-06-14 14:00:37 +00:00
|
|
|
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.
|
2019-06-14 14:00:37 +00:00
|
|
|
void closeLogs(Poco::Logger & logger);
|
|
|
|
|
2022-03-03 20:27:46 +00:00
|
|
|
#ifdef WITH_TEXT_LOG
|
2020-01-23 20:19:51 +00:00
|
|
|
void setTextLog(std::shared_ptr<DB::TextLog> log, int max_priority);
|
2022-03-03 20:27:46 +00:00
|
|
|
#endif
|
2019-07-30 14:04:18 +00:00
|
|
|
|
2019-06-14 14:00:37 +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
|
|
|
|
2019-06-14 14:00:37 +00:00
|
|
|
/// Previous value of logger element in config. It is used to reinitialize loggers whenever the value changed.
|
|
|
|
std::string config_logger;
|
2019-07-30 14:04:18 +00:00
|
|
|
|
2022-03-03 20:27:46 +00:00
|
|
|
#ifdef WITH_TEXT_LOG
|
2019-07-30 14:04:18 +00:00
|
|
|
std::weak_ptr<DB::TextLog> text_log;
|
2020-01-23 20:19:51 +00:00
|
|
|
int text_log_max_priority = -1;
|
2022-03-03 20:27:46 +00:00
|
|
|
#endif
|
2020-01-23 20:19:51 +00:00
|
|
|
|
2019-07-30 14:04:18 +00:00
|
|
|
Poco::AutoPtr<DB::OwnSplitChannel> split;
|
2019-06-14 14:00:37 +00:00
|
|
|
};
|