lintel 0.2.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
lintel::LoggerService Class Reference

#include <LoggerService.h>

Public Member Functions

 LoggerService ()
 
 LoggerService (std::shared_ptr< ProcessName > processName, std::shared_ptr< Configuration > configuration)
 
 ~LoggerService ()
 
template<typename... Args>
void log (const char *file, int line, const char *function, LogLevel lvl, std::string_view message, Args &&...args)
 

Static Public Member Functions

static LoggerService & getOrCreate (const std::shared_ptr< ProcessName > &processInfo, const std::shared_ptr< Configuration > &configuration)
 
static LoggerService & get ()
 
static void initSingleton (const std::shared_ptr< ProcessName > &processInfo, const std::shared_ptr< Configuration > &configuration)
 
static void initSingleton2 ()
 

Detailed Description

Singleton service providing spdlog-based logging for the application.

Constructor & Destructor Documentation

◆ LoggerService() [1/2]

lintel::LoggerService::LoggerService ( )

Default constructor.

◆ LoggerService() [2/2]

lintel::LoggerService::LoggerService ( std::shared_ptr< ProcessName >  processName,
std::shared_ptr< Configuration >  configuration 
)

Construct a LoggerService with the given process name and configuration.

Parameters
processNamethe process name
configurationthe application configuration

◆ ~LoggerService()

lintel::LoggerService::~LoggerService ( )

Destructor.

Member Function Documentation

◆ get()

static LoggerService & lintel::LoggerService::get ( )
static

Get the singleton logger service instance.

Returns
reference to the singleton LoggerService

◆ getOrCreate()

static LoggerService & lintel::LoggerService::getOrCreate ( const std::shared_ptr< ProcessName > &  processInfo,
const std::shared_ptr< Configuration > &  configuration 
)
static

Get or create the singleton logger service instance.

Parameters
processInfothe process name information
configurationthe application configuration
Returns
reference to the singleton LoggerService

◆ initSingleton()

static void lintel::LoggerService::initSingleton ( const std::shared_ptr< ProcessName > &  processInfo,
const std::shared_ptr< Configuration > &  configuration 
)
static

Initialize the singleton with the given parameters.

Parameters
processInfothe process name information
configurationthe application configuration

◆ initSingleton2()

static void lintel::LoggerService::initSingleton2 ( )
static

Initialize the singleton a second time (re-init).

◆ log()

template<typename... Args>
void lintel::LoggerService::log ( const char *  file,
int  line,
const char *  function,
LogLevel  lvl,
std::string_view  message,
Args &&...  args 
)
inline

Log a formatted message at the given level with source location. Template-eliminated: boxes the arguments (std::make_format_args) and defers all formatting to the non-template logImpl() in LoggerService.cpp.

Template Parameters
Argsthe argument types
Parameters
filethe source file name
linethe source line number
functionthe source function name
lvlthe log level
messagethe format string
argsthe format arguments

The documentation for this class was generated from the following file: