2015-09-29 19:21:02 +00:00
|
|
|
#pragma once
|
2017-02-02 14:19:13 +00:00
|
|
|
|
|
|
|
/// Macros for convenient usage of Poco logger.
|
2015-09-29 19:21:02 +00:00
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
#include <Poco/Logger.h>
|
|
|
|
|
|
|
|
#ifndef QUERY_PREVIEW_LENGTH
|
|
|
|
#define QUERY_PREVIEW_LENGTH 160
|
|
|
|
#endif
|
|
|
|
|
|
|
|
using Poco::Logger;
|
|
|
|
|
|
|
|
/// Logs a message to a specified logger with that level.
|
|
|
|
|
|
|
|
#define LOG_TRACE(logger, message) do { \
|
2017-04-01 07:20:54 +00:00
|
|
|
if ((logger)->trace()) {\
|
|
|
|
std::stringstream oss_internal_rare; \
|
|
|
|
oss_internal_rare << message; \
|
2017-08-04 14:00:26 +00:00
|
|
|
(logger)->trace(oss_internal_rare.str());}} while(false)
|
2015-09-29 19:21:02 +00:00
|
|
|
|
|
|
|
#define LOG_DEBUG(logger, message) do { \
|
2017-04-01 07:20:54 +00:00
|
|
|
if ((logger)->debug()) {\
|
|
|
|
std::stringstream oss_internal_rare; \
|
|
|
|
oss_internal_rare << message; \
|
2017-08-04 14:00:26 +00:00
|
|
|
(logger)->debug(oss_internal_rare.str());}} while(false)
|
2015-09-29 19:21:02 +00:00
|
|
|
|
|
|
|
#define LOG_INFO(logger, message) do { \
|
2017-04-01 07:20:54 +00:00
|
|
|
if ((logger)->information()) {\
|
|
|
|
std::stringstream oss_internal_rare; \
|
|
|
|
oss_internal_rare << message; \
|
2017-08-04 14:00:26 +00:00
|
|
|
(logger)->information(oss_internal_rare.str());}} while(false)
|
2015-09-29 19:21:02 +00:00
|
|
|
|
|
|
|
#define LOG_NOTICE(logger, message) do { \
|
2017-04-01 07:20:54 +00:00
|
|
|
if ((logger)->notice()) {\
|
|
|
|
std::stringstream oss_internal_rare; \
|
|
|
|
oss_internal_rare << message; \
|
2017-08-04 14:00:26 +00:00
|
|
|
(logger)->notice(oss_internal_rare.str());}} while(false)
|
2015-09-29 19:21:02 +00:00
|
|
|
|
|
|
|
#define LOG_WARNING(logger, message) do { \
|
2017-04-01 07:20:54 +00:00
|
|
|
if ((logger)->warning()) {\
|
|
|
|
std::stringstream oss_internal_rare; \
|
|
|
|
oss_internal_rare << message; \
|
2017-08-04 14:00:26 +00:00
|
|
|
(logger)->warning(oss_internal_rare.str());}} while(false)
|
2015-09-29 19:21:02 +00:00
|
|
|
|
|
|
|
#define LOG_ERROR(logger, message) do { \
|
2017-04-01 07:20:54 +00:00
|
|
|
if ((logger)->error()) {\
|
|
|
|
std::stringstream oss_internal_rare; \
|
|
|
|
oss_internal_rare << message; \
|
2017-08-04 14:00:26 +00:00
|
|
|
(logger)->error(oss_internal_rare.str());}} while(false)
|
2015-09-29 19:21:02 +00:00
|
|
|
|
|
|
|
#define LOG_CRITICAL(logger, message) do { \
|
2017-04-01 07:20:54 +00:00
|
|
|
if ((logger)->critical()) {\
|
|
|
|
std::stringstream oss_internal_rare; \
|
|
|
|
oss_internal_rare << message; \
|
2017-08-04 14:00:26 +00:00
|
|
|
(logger)->critical(oss_internal_rare.str());}} while(false)
|
2015-09-29 19:21:02 +00:00
|
|
|
|
|
|
|
#define LOG_FATAL(logger, message) do { \
|
2017-04-01 07:20:54 +00:00
|
|
|
if ((logger)->fatal()) {\
|
|
|
|
std::stringstream oss_internal_rare; \
|
|
|
|
oss_internal_rare << message; \
|
2017-08-04 14:00:26 +00:00
|
|
|
(logger)->fatal(oss_internal_rare.str());}} while(false)
|