27#include <spdlog/common.h>
28#include <spdlog/logger.h>
46 using spdlog::level::level_enum;
49 return level_enum::trace;
51 return level_enum::debug;
53 return level_enum::info;
55 return level_enum::warn;
57 return level_enum::err;
59 return level_enum::critical;
61 return level_enum::trace;
78 "Null logger was given to SpdlogLogSink class.");
82 logger_->set_level(spdlog::level::trace);
87 std::string_view body)
override {
89 spdlog::source_loc(location.
file_path().data(),
90 static_cast<int>(location.
line()), location.
function().data()),
107 const std::shared_ptr<spdlog::logger>& logger) {
108 logger->set_pattern(
"[%Y-%m-%d %H:%M:%S.%f] [%^%l%$] %v (%s:%#, %!)");
118 const std::shared_ptr<spdlog::logger>& logger) {
119 logger->set_pattern(
"[%Y-%m-%d %H:%M:%S.%f] [%l] %v (%@, %!)");
Class of exceptions in cpp-msgpack-rpc library.
Class of locations in source codes.
constexpr std::uint32_t line() const noexcept
Get the line number.
constexpr std::string_view file_path() const noexcept
Get the file path.
constexpr std::string_view function() const noexcept
Get the function name.
std::shared_ptr< spdlog::logger > logger_
Logger in spdlog library.
void write(SourceLocationView location, LogLevel level, std::string_view body) override
Write a log.
SpdlogLogSink(std::shared_ptr< spdlog::logger > logger)
Constructor.
Definition of ILogSink class.
Definition of LogLevel enumeration.
Definition of MsgpackRPCException class.
Namespace of internal implementation of logging using spdlog library.
spdlog::level::level_enum convert_log_level(LogLevel level)
Convert a log level in this library to a log level in spdlog library.
void configure_spdlog_logger_format_for_consoles(const std::shared_ptr< spdlog::logger > &logger)
Configure the log format of a logger in spdlog library for output to consoles.
void configure_spdlog_logger_format_for_files(const std::shared_ptr< spdlog::logger > &logger)
Configure the log format of a logger in spdlog library for output to files.
LogLevel
Enumeration of log levels.
@ TRACE
Trace. (Internal operations to send and receive messages.)
@ WARN
Warnings. (Unexpected conditions which don't stop operations.)
@ INFO
Information. (Not used in this library.)
@ CRITICAL
Critical. (Unexpected conditions which can stop all operations in communication.)
@ ERROR
Error. (Unexpected conditions which stop some operations in communication.)
@ DEBUG
Debug. (Log of messages, initialization and finalization of clients and servers.)
Definition of SourceLocationView class.
Definition of StatusCode enumeration.