ClickHouse/libs/libloggers/loggers/ExtendedLogChannel.cpp
proller 09f3d68f6e Use logging in clickhouse-local. Use config options in command line in clickhouse-client (#5540)
* Try fix macos server run

* Doc macos build
 # Please enter the commit message for your changes. Lines starting

* CLICKHOUSE-3957 start wip

* tests wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* fix

* fix

* Making logger for clickhouse-local

* fixes

* wip

* wip

* wip

* wip

* clean

*      cf

* wip

* fix

* Update CMakeLists.txt

* Update argsToConfig.h

* Update argsToConfig.cpp

* Update ExtendedLogChannel.h

* Update OwnPatternFormatter.cpp
2019-06-14 17:00:37 +03:00

36 lines
779 B
C++

#include "ExtendedLogChannel.h"
#include <sys/time.h>
#include <Common/CurrentThread.h>
#include <Common/Exception.h>
#include <common/getThreadNumber.h>
namespace DB
{
namespace ErrorCodes
{
extern const int CANNOT_GETTIMEOFDAY;
}
ExtendedLogMessage ExtendedLogMessage::getFrom(const Poco::Message & base)
{
ExtendedLogMessage msg_ext(base);
::timeval tv;
if (0 != gettimeofday(&tv, nullptr))
DB::throwFromErrno("Cannot gettimeofday", ErrorCodes::CANNOT_GETTIMEOFDAY);
msg_ext.time_seconds = static_cast<UInt32>(tv.tv_sec);
msg_ext.time_microseconds = static_cast<UInt32>(tv.tv_usec);
if (current_thread)
msg_ext.query_id = CurrentThread::getQueryId();
msg_ext.thread_number = getThreadNumber();
return msg_ext;
}
}