Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
util::Logger Class Reference

A simple thread-safe logger for the channel specified in the constructor. More...

#include <Logger.hpp>

Public Member Functions

 Logger (std::string_view const channel)
 Construct a new Logger object that produces loglines for the specified channel.
 Logger (Logger const &)=default
 Logger (Logger &&)=default
Loggeroperator= (Logger const &)=default
Loggeroperator= (Logger &&)=default
Pump trace (std::source_location const &loc=std::source_location::current()) const
 Interface for logging at Severity::TRC severity.
Pump debug (std::source_location const &loc=std::source_location::current()) const
 Interface for logging at Severity::DBG severity.
Pump info (std::source_location const &loc=std::source_location::current()) const
 Interface for logging at Severity::NFO severity.
Pump warn (std::source_location const &loc=std::source_location::current()) const
 Interface for logging at Severity::WRN severity.
Pump error (std::source_location const &loc=std::source_location::current()) const
 Interface for logging at Severity::ERR severity.
Pump fatal (std::source_location const &loc=std::source_location::current()) const
 Interface for logging at Severity::FTL severity.

Static Public Attributes

static constexpr std::array< std::string_view, 8 > kChannels

Friends

class LogService
struct ::BenchmarkLoggingInitializer

Detailed Description

A simple thread-safe logger for the channel specified in the constructor.

This is cheap to copy and move. Designed to be used as a member variable or otherwise. See LogService::init() for setup of the logging core and severity levels for each channel.

Constructor & Destructor Documentation

◆ Logger()

util::Logger::Logger ( std::string_view const channel)

Construct a new Logger object that produces loglines for the specified channel.

See LogService::init() for general setup and configuration of severity levels per channel.

Parameters
channelThe channel this logger will report into.

Member Function Documentation

◆ debug()

Logger::Pump util::Logger::debug ( std::source_location const & loc = std::source_location::current()) const
nodiscard

Interface for logging at Severity::DBG severity.

Parameters
locThe source location of the log message
Returns
The pump to use for logging

◆ error()

Logger::Pump util::Logger::error ( std::source_location const & loc = std::source_location::current()) const
nodiscard

Interface for logging at Severity::ERR severity.

Parameters
locThe source location of the log message
Returns
The pump to use for logging

◆ fatal()

Logger::Pump util::Logger::fatal ( std::source_location const & loc = std::source_location::current()) const
nodiscard

Interface for logging at Severity::FTL severity.

Parameters
locThe source location of the log message
Returns
The pump to use for logging

◆ info()

Logger::Pump util::Logger::info ( std::source_location const & loc = std::source_location::current()) const
nodiscard

Interface for logging at Severity::NFO severity.

Parameters
locThe source location of the log message
Returns
The pump to use for logging

◆ trace()

Logger::Pump util::Logger::trace ( std::source_location const & loc = std::source_location::current()) const
nodiscard

Interface for logging at Severity::TRC severity.

Parameters
locThe source location of the log message
Returns
The pump to use for logging

◆ warn()

Logger::Pump util::Logger::warn ( std::source_location const & loc = std::source_location::current()) const
nodiscard

Interface for logging at Severity::WRN severity.

Parameters
locThe source location of the log message
Returns
The pump to use for logging

Member Data Documentation

◆ kChannels

std::array<std::string_view, 8> util::Logger::kChannels
staticconstexpr
Initial value:
= {
"General",
"WebServer",
"Backend",
"RPC",
"ETL",
"Subscriptions",
"Performance",
"Migration",
}

The documentation for this class was generated from the following files:
  • /__w/clio/clio/src/util/log/Logger.hpp
  • /__w/clio/clio/src/util/log/Logger.cpp