2018-06-06 20:57:07 +00:00
|
|
|
#pragma once
|
|
|
|
#include <IO/WriteBuffer.h>
|
2021-10-14 10:25:43 +00:00
|
|
|
#include <Core/Block.h>
|
2018-06-06 20:57:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2021-10-12 18:03:54 +00:00
|
|
|
/// Prints internal server logs or profile events with colored output (if requested).
|
2021-04-13 20:04:13 +00:00
|
|
|
/// NOTE: IRowOutputFormat does not suite well for this case
|
2021-10-08 14:03:54 +00:00
|
|
|
class InternalTextLogs
|
2018-06-06 20:57:07 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-10-08 14:03:54 +00:00
|
|
|
InternalTextLogs(WriteBuffer & buf_out, bool color_) : wb(buf_out), color(color_) {}
|
2018-06-06 20:57:07 +00:00
|
|
|
|
2021-10-12 18:03:54 +00:00
|
|
|
/// 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);
|
2018-06-06 20:57:07 +00:00
|
|
|
|
2021-10-08 14:03:54 +00:00
|
|
|
void flush()
|
2018-06-06 20:57:07 +00:00
|
|
|
{
|
|
|
|
wb.next();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
WriteBuffer & wb;
|
2020-02-21 20:01:38 +00:00
|
|
|
bool color;
|
2018-06-06 20:57:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|