CppLogging  1.0.4.0
C++ Logging Library
Public Member Functions | Friends | List of all members
CppLogging::Logger Class Reference

Logger interface. More...

#include <logger.h>

Public Member Functions

 Logger ()
 Initialize default logger. More...
 
 Logger (const std::string &name)
 Initialize named logger. More...
 
 Logger (const Logger &)=default
 
 Logger (Logger &&)=default
 
 ~Logger ()
 
Loggeroperator= (const Logger &)=default
 
Loggeroperator= (Logger &&)=default
 
void Debug (std::string_view message) const
 Log debug message. More...
 
template<typename... T>
void Debug (fmt::format_string< T... > message, T &&... args) const
 Log debug message with format arguments. More...
 
void Info (std::string_view message) const
 Log information message. More...
 
template<typename... T>
void Info (fmt::format_string< T... > message, T &&... args) const
 Log information message with format arguments. More...
 
void Warn (std::string_view message) const
 Log warning message. More...
 
template<typename... T>
void Warn (fmt::format_string< T... > message, T &&... args) const
 Log warning message with format arguments. More...
 
void Error (std::string_view message) const
 Log error message. More...
 
template<typename... T>
void Error (fmt::format_string< T... > message, T &&... args) const
 Log error message with format arguments. More...
 
void Fatal (std::string_view message) const
 Log fatal message. More...
 
template<typename... T>
void Fatal (fmt::format_string< T... > message, T &&... args) const
 Log fatal message with format arguments. More...
 
void Flush ()
 Flush the current logger. More...
 
void Update ()
 Update the current logger sink by taking the most recent one from configuration. More...
 

Friends

class Config
 

Detailed Description

Logger interface.

Logger is a main interface to produce logging records with a desired level.

Thread-safe or not thread-safe depends on the current logging sink.

Examples
async.cpp, console.cpp, default.cpp, file.cpp, format.cpp, sync.cpp, and syslog.cpp.

Definition at line 22 of file logger.h.

Constructor & Destructor Documentation

◆ Logger() [1/4]

CppLogging::Logger::Logger ( )

Initialize default logger.

Definition at line 15 of file logger.cpp.

◆ Logger() [2/4]

CppLogging::Logger::Logger ( const std::string &  name)
explicit

Initialize named logger.

Parameters
name- Logger name

Definition at line 19 of file logger.cpp.

◆ Logger() [3/4]

CppLogging::Logger::Logger ( const Logger )
default

◆ Logger() [4/4]

CppLogging::Logger::Logger ( Logger &&  )
default

◆ ~Logger()

CppLogging::Logger::~Logger ( )
inline

Definition at line 15 of file logger.inl.

Member Function Documentation

◆ Debug() [1/2]

template<typename... T>
void CppLogging::Logger::Debug ( fmt::format_string< T... >  message,
T &&...  args 
) const
inline

Log debug message with format arguments.

Will log only in debug mode!

Parameters
message- Debug message
args- Format arguments

Definition at line 56 of file logger.inl.

◆ Debug() [2/2]

void CppLogging::Logger::Debug ( std::string_view  message) const
inline

Log debug message.

Will log only in debug mode!

Parameters
message- Debug message
Examples
console.cpp, default.cpp, and syslog.cpp.

Definition at line 47 of file logger.h.

◆ Error() [1/2]

template<typename... T>
void CppLogging::Logger::Error ( fmt::format_string< T... >  message,
T &&...  args 
) const
inline

Log error message with format arguments.

Parameters
message- Error message
args- Format arguments

Definition at line 78 of file logger.inl.

◆ Error() [2/2]

void CppLogging::Logger::Error ( std::string_view  message) const
inline

Log error message.

Parameters
message- Error message
Examples
console.cpp, default.cpp, and syslog.cpp.

Definition at line 88 of file logger.h.

◆ Fatal() [1/2]

template<typename... T>
void CppLogging::Logger::Fatal ( fmt::format_string< T... >  message,
T &&...  args 
) const
inline

Log fatal message with format arguments.

Parameters
message- Fatal message
args- Format arguments

Definition at line 84 of file logger.inl.

◆ Fatal() [2/2]

void CppLogging::Logger::Fatal ( std::string_view  message) const
inline

Log fatal message.

Parameters
message- Fatal message
Examples
console.cpp, default.cpp, and syslog.cpp.

Definition at line 101 of file logger.h.

◆ Flush()

void CppLogging::Logger::Flush ( )
inline

Flush the current logger.

Definition at line 89 of file logger.inl.

◆ Info() [1/2]

template<typename... T>
void CppLogging::Logger::Info ( fmt::format_string< T... >  message,
T &&...  args 
) const
inline

Log information message with format arguments.

Parameters
message- Information message
args- Format arguments

Definition at line 66 of file logger.inl.

◆ Info() [2/2]

void CppLogging::Logger::Info ( std::string_view  message) const
inline

Log information message.

Parameters
message- Information message
Examples
console.cpp, default.cpp, format.cpp, and syslog.cpp.

Definition at line 62 of file logger.h.

◆ operator=() [1/2]

Logger& CppLogging::Logger::operator= ( const Logger )
default

◆ operator=() [2/2]

Logger& CppLogging::Logger::operator= ( Logger &&  )
default

◆ Update()

void CppLogging::Logger::Update ( )

Update the current logger sink by taking the most recent one from configuration.

Definition at line 23 of file logger.cpp.

◆ Warn() [1/2]

template<typename... T>
void CppLogging::Logger::Warn ( fmt::format_string< T... >  message,
T &&...  args 
) const
inline

Log warning message with format arguments.

Parameters
message- Warning message
args- Format arguments

Definition at line 72 of file logger.inl.

◆ Warn() [2/2]

void CppLogging::Logger::Warn ( std::string_view  message) const
inline

Log warning message.

Parameters
message- Warning message
Examples
console.cpp, default.cpp, and syslog.cpp.

Definition at line 75 of file logger.h.

Friends And Related Function Documentation

◆ Config

friend class Config
friend

Definition at line 24 of file logger.h.


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