1 | #pragma once |
2 | #include <string> |
3 | |
4 | namespace Poco |
5 | { |
6 | class Message; |
7 | } |
8 | |
9 | namespace DB |
10 | { |
11 | /// Poco::Message with more ClickHouse-specific info |
12 | /// NOTE: Poco::Message is not polymorphic class, so we can't use inheritance in couple with dynamic_cast<>() |
13 | class ExtendedLogMessage |
14 | { |
15 | public: |
16 | explicit ExtendedLogMessage(const Poco::Message & base_) : base(base_) {} |
17 | |
18 | /// Attach additional data to the message |
19 | static ExtendedLogMessage getFrom(const Poco::Message & base); |
20 | |
21 | // Do not copy for efficiency reasons |
22 | const Poco::Message & base; |
23 | |
24 | uint32_t time_seconds = 0; |
25 | uint32_t time_microseconds = 0; |
26 | |
27 | uint32_t thread_number = 0; |
28 | std::string query_id; |
29 | }; |
30 | |
31 | |
32 | /// Interface extension of Poco::Channel |
33 | class ExtendedLogChannel |
34 | { |
35 | public: |
36 | virtual void logExtended(const ExtendedLogMessage & msg) = 0; |
37 | virtual ~ExtendedLogChannel() = default; |
38 | }; |
39 | |
40 | } |
41 | |