mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
424bf6fcf4
This can be useful for debugging and for testing (since you will not need to obtain query_id and look at query_log). v2: - mark test as long - add option to docs - add type of profile event into logs too v3: - resolve conflicts - and fix onProfileEvents callback v4: - add --print-profile-events separate switch
52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
#pragma once
|
|
#include <IO/WriteBuffer.h>
|
|
#include <Core/Block.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/// Prints internal server logs or profile events with colored output (if requested).
|
|
/// NOTE: IRowOutputFormat does not suite well for this case
|
|
class InternalTextLogs
|
|
{
|
|
public:
|
|
InternalTextLogs(WriteBuffer & buf_out, bool color_) : wb(buf_out), color(color_) {}
|
|
|
|
/// Print internal server logs
|
|
///
|
|
/// Input blocks have to have the same structure as SystemLogsQueue::getSampleBlock():
|
|
/// - event_time
|
|
/// - event_time_microseconds
|
|
/// - host_name
|
|
/// - query_id
|
|
/// - thread_id
|
|
/// - priority
|
|
/// - source
|
|
/// - text
|
|
void writeLogs(const Block & block);
|
|
/// Print profile events.
|
|
///
|
|
/// Block:
|
|
/// - host_name
|
|
/// - current_time
|
|
/// - thread_id
|
|
/// - type
|
|
/// - name
|
|
/// - value
|
|
///
|
|
/// See also TCPHandler::sendProfileEvents() for block columns.
|
|
void writeProfileEvents(const Block & block);
|
|
|
|
void flush()
|
|
{
|
|
wb.next();
|
|
}
|
|
|
|
private:
|
|
WriteBuffer & wb;
|
|
bool color;
|
|
};
|
|
|
|
}
|