cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
logger.h File Reference

Definition of Logger class. More...

#include <iterator>
#include <memory>
#include <string_view>
#include <utility>
#include <fmt/base.h>
#include <fmt/format.h>
#include "msgpack_rpc/config/logging_config.h"
#include "msgpack_rpc/logging/i_log_sink.h"
#include "msgpack_rpc/logging/log_level.h"
#include "msgpack_rpc/logging/log_sinks.h"
#include "msgpack_rpc/logging/source_location_view.h"
Include dependency graph for logger.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  msgpack_rpc::logging::Logger
 Class to write logs. More...

Namespaces

namespace  msgpack_rpc
 Namespace of cpp-msgpack-rpc library.
namespace  msgpack_rpc::logging
 Namespace of logging.

Macros

#define MSGPACK_RPC_CRITICAL(LOGGER_PTR, ...)
 Write a critical log.
#define MSGPACK_RPC_DEBUG(LOGGER_PTR, ...)
 Write a debug log.
#define MSGPACK_RPC_ERROR(LOGGER_PTR, ...)
 Write a error log.
#define MSGPACK_RPC_INFO(LOGGER_PTR, ...)
 Write a information log.
#define MSGPACK_RPC_LOG(LOGGER_PTR, LEVEL, ...)
 Write a log.
#define MSGPACK_RPC_TRACE(LOGGER_PTR, ...)
 Write a trace log.
#define MSGPACK_RPC_WARN(LOGGER_PTR, ...)
 Write a warning log.

Detailed Description

Definition of Logger class.

Definition in file logger.h.

Macro Definition Documentation

◆ MSGPACK_RPC_CRITICAL

#define MSGPACK_RPC_CRITICAL ( LOGGER_PTR,
... )
Value:
#define MSGPACK_RPC_LOG(LOGGER_PTR, LEVEL,...)
Write a log.
Definition logger.h:157
@ CRITICAL
Critical. (Unexpected conditions which can stop all operations in communication.)
Definition log_level.h:46

Write a critical log.

Parameters
[in]LOGGER_PTRPointer to the logger.

Remaining arguments are the format of the log body and its arguments, or the log body itself.

Examples
more_client.cpp.

Definition at line 234 of file logger.h.

◆ MSGPACK_RPC_DEBUG

#define MSGPACK_RPC_DEBUG ( LOGGER_PTR,
... )
Value:
LOGGER_PTR, ::msgpack_rpc::logging::LogLevel::DEBUG, __VA_ARGS__)
@ DEBUG
Debug. (Log of messages, initialization and finalization of clients and servers.)
Definition log_level.h:34

Write a debug log.

Parameters
[in]LOGGER_PTRPointer to the logger.

Remaining arguments are the format of the log body and its arguments, or the log body itself.

Definition at line 186 of file logger.h.

◆ MSGPACK_RPC_ERROR

#define MSGPACK_RPC_ERROR ( LOGGER_PTR,
... )
Value:
LOGGER_PTR, ::msgpack_rpc::logging::LogLevel::ERROR, __VA_ARGS__)
@ ERROR
Error. (Unexpected conditions which stop some operations in communication.)
Definition log_level.h:43

Write a error log.

Parameters
[in]LOGGER_PTRPointer to the logger.

Remaining arguments are the format of the log body and its arguments, or the log body itself.

Definition at line 222 of file logger.h.

◆ MSGPACK_RPC_INFO

#define MSGPACK_RPC_INFO ( LOGGER_PTR,
... )
Value:
LOGGER_PTR, ::msgpack_rpc::logging::LogLevel::INFO, __VA_ARGS__)
@ INFO
Information. (Not used in this library.)
Definition log_level.h:37

Write a information log.

Parameters
[in]LOGGER_PTRPointer to the logger.

Remaining arguments are the format of the log body and its arguments, or the log body itself.

Examples
more_client.cpp, and more_server.cpp.

Definition at line 198 of file logger.h.

◆ MSGPACK_RPC_LOG

#define MSGPACK_RPC_LOG ( LOGGER_PTR,
LEVEL,
... )
Value:
do { \
if (LEVEL >= (LOGGER_PTR)->output_log_level()) { \
(LOGGER_PTR) \
__VA_ARGS__); \
} \
} while (false)
#define MSGPACK_RPC_CURRENT_SOURCE_LOCATION()
Macro to get the current location in source codes.

Write a log.

Parameters
[in]LOGGER_PTRPointer to the logger.
[in]LEVELLog level.

Remaining arguments are the format of the log body and its arguments, or the log body itself.

Definition at line 157 of file logger.h.

◆ MSGPACK_RPC_TRACE

#define MSGPACK_RPC_TRACE ( LOGGER_PTR,
... )
Value:
LOGGER_PTR, ::msgpack_rpc::logging::LogLevel::TRACE, __VA_ARGS__)
@ TRACE
Trace. (Internal operations to send and receive messages.)
Definition log_level.h:31

Write a trace log.

Parameters
[in]LOGGER_PTRPointer to the logger.

Remaining arguments are the format of the log body and its arguments, or the log body itself.

Definition at line 174 of file logger.h.

◆ MSGPACK_RPC_WARN

#define MSGPACK_RPC_WARN ( LOGGER_PTR,
... )
Value:
LOGGER_PTR, ::msgpack_rpc::logging::LogLevel::WARN, __VA_ARGS__)
@ WARN
Warnings. (Unexpected conditions which don't stop operations.)
Definition log_level.h:40

Write a warning log.

Parameters
[in]LOGGER_PTRPointer to the logger.

Remaining arguments are the format of the log body and its arguments, or the log body itself.

Definition at line 210 of file logger.h.