mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 05:22:17 +00:00
56 lines
1.2 KiB
C++
56 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <Interpreters/SystemLog.h>
|
|
#include <Core/NamesAndTypes.h>
|
|
#include <Core/NamesAndAliases.h>
|
|
#include <Poco/Message.h>
|
|
#include <Storages/ColumnsDescription.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
using Poco::Message;
|
|
|
|
struct TextLogElement
|
|
{
|
|
time_t event_time{};
|
|
Decimal64 event_time_microseconds{};
|
|
|
|
String thread_name;
|
|
UInt64 thread_id{};
|
|
|
|
Message::Priority level = Message::PRIO_TRACE;
|
|
|
|
String query_id;
|
|
String logger_name;
|
|
String message;
|
|
|
|
String source_file;
|
|
UInt64 source_line{};
|
|
|
|
std::string_view message_format_string;
|
|
|
|
static std::string name() { return "TextLog"; }
|
|
static ColumnsDescription getColumnsDescription();
|
|
static NamesAndAliases getNamesAndAliases() { return {}; }
|
|
void appendToBlock(MutableColumns & columns) const;
|
|
};
|
|
|
|
class TextLog : public SystemLog<TextLogElement>
|
|
{
|
|
public:
|
|
using Queue = SystemLogQueue<TextLogElement>;
|
|
|
|
explicit TextLog(ContextPtr context_, const SystemLogSettings & settings);
|
|
|
|
static std::shared_ptr<Queue> getLogQueue(const SystemLogQueueSettings & settings)
|
|
{
|
|
static std::shared_ptr<Queue> queue = std::make_shared<Queue>(settings);
|
|
return queue;
|
|
}
|
|
|
|
static consteval bool shouldTurnOffLogger() { return true; }
|
|
};
|
|
|
|
}
|