2018-06-15 17:32:35 +00:00
|
|
|
#pragma once
|
2019-06-14 14:00:37 +00:00
|
|
|
#include <string>
|
2018-06-15 17:32:35 +00:00
|
|
|
|
2019-06-14 14:00:37 +00:00
|
|
|
namespace Poco
|
|
|
|
{
|
|
|
|
class Message;
|
|
|
|
}
|
2018-06-15 17:32:35 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
/// Poco::Message with more ClickHouse-specific info
|
|
|
|
/// NOTE: Poco::Message is not polymorphic class, so we can't use inheritance in couple with dynamic_cast<>()
|
|
|
|
class ExtendedLogMessage
|
|
|
|
{
|
|
|
|
public:
|
2019-08-03 11:02:40 +00:00
|
|
|
explicit ExtendedLogMessage(const Poco::Message & base_) : base(base_) {}
|
2018-06-15 17:32:35 +00:00
|
|
|
|
|
|
|
/// Attach additional data to the message
|
|
|
|
static ExtendedLogMessage getFrom(const Poco::Message & base);
|
|
|
|
|
|
|
|
// Do not copy for efficiency reasons
|
|
|
|
const Poco::Message & base;
|
|
|
|
|
2019-06-14 14:00:37 +00:00
|
|
|
uint32_t time_seconds = 0;
|
|
|
|
uint32_t time_microseconds = 0;
|
2020-09-06 00:01:51 +00:00
|
|
|
uint64_t time_in_microseconds = 0;
|
2018-06-15 17:32:35 +00:00
|
|
|
|
2020-02-02 20:01:13 +00:00
|
|
|
uint64_t thread_id = 0;
|
2018-06-15 17:32:35 +00:00
|
|
|
std::string query_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// Interface extension of Poco::Channel
|
|
|
|
class ExtendedLogChannel
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void logExtended(const ExtendedLogMessage & msg) = 0;
|
|
|
|
virtual ~ExtendedLogChannel() = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|