eDSP  0.0.1
A cross-platform DSP library written in C++.
Public Types | Public Member Functions | Static Public Member Functions | List of all members
edsp::core::logger Class Reference

#include <logger.hpp>

Public Types

enum  levels {
  trace = 0, debug, info, warning,
  error, critical, off
}
 
using logger_manipulator = std::function< edsp::core::logger &(edsp::core::logger &)>
 

Public Member Functions

 logger (const edsp::string_view &name, const edsp::string_view &file, levels message_type=levels::trace)
 Constructs a logger to record log messages of message_type for the file. More...
 
 logger (const edsp::string_view &name, levels message_type=levels::trace)
 Constructs a logger to record log messages of message_type in a terminal. More...
 
 logger (levels message_type=levels::trace)
 Created the default logger to record log messages of message_type. More...
 
 ~logger ()
 Default destructor. More...
 
void set_level (levels type)
 Updates the minimum level to be logged. More...
 
levels level ()
 Returns the default level. More...
 
loggerspace ()
 Writes an space character to the stream and returns a reference to the stream. More...
 
const std::string & name () const
 Returns the name of the logger. More...
 
std::string str () const
 Returns the current string buffer. More...
 
loggeroperator<< (logger_manipulator manipulator)
 
loggeroperator<< (std::uint8_t)
 
loggeroperator<< (std::uint16_t)
 
loggeroperator<< (std::uint32_t)
 
loggeroperator<< (std::uint64_t)
 
loggeroperator<< (std::int8_t)
 
loggeroperator<< (std::int16_t)
 
loggeroperator<< (std::int32_t)
 
loggeroperator<< (std::int64_t)
 
loggeroperator<< (float)
 
loggeroperator<< (double)
 
loggeroperator<< (const char *)
 
template<typename Char >
loggeroperator<< (const std::basic_string< Char > &str)
 
template<typename Char >
loggeroperator<< (const edsp::basic_string_view< Char > &str)
 

Static Public Member Functions

static void set_default_level (levels type)
 Updates the minimum level to be logged. More...
 
static levels default_level ()
 Returns the default level. More...
 
static void set_default_path (const std::string &path)
 Updates the default file path of the file holding the default logger. More...
 
static const std::string & default_path ()
 Returns the current file path of the default logger. More...
 
static void set_default_name (const std::string &name)
 Updates the name of the default logger. More...
 
static const std::string & default_name ()
 Returns the name of the default logger. More...
 
static void set_pattern (const std::string &pattern)
 Updates the pattern of the displayed messages. More...
 

Member Typedef Documentation

◆ logger_manipulator

Member Enumeration Documentation

◆ levels

The MessageLevelType enum describes the messages that can be sent to a message handler

Enumerator
trace 

Trace Message

debug 

Debug Message

info 

Information Message

warning 

Warning Message

error 

Error Message

critical 

Critical Message

off 

Disable the logger

Constructor & Destructor Documentation

◆ logger() [1/3]

edsp::core::logger::logger ( const edsp::string_view &  name,
const edsp::string_view &  file,
logger::levels  message_type = levels::trace 
)
inline

Constructs a logger to record log messages of message_type for the file.

Parameters
nameName or key of the logger.
fileFile-path to stores the message. Use "console" to output the messages in the terminal.
message_typeType of the message.
See also
MessageLevelType

◆ logger() [2/3]

edsp::core::logger::logger ( const edsp::string_view &  name,
logger::levels  message_type = levels::trace 
)
inlineexplicit

Constructs a logger to record log messages of message_type in a terminal.

Parameters
nameName or key of the logger.
message_typeType of the message.
See also
MessageLevelType

◆ logger() [3/3]

edsp::core::logger::logger ( logger::levels  message_type = levels::trace)
inlineexplicit

Created the default logger to record log messages of message_type.

Parameters
message_typeType of the message.
  • *
See also
MessageLevelType

◆ ~logger()

edsp::core::logger::~logger ( )
inline

Default destructor.

Member Function Documentation

◆ default_level()

logger::levels edsp::core::logger::default_level ( )
inlinestatic

Returns the default level.

Returns
Current level that triggers the logger.

◆ default_name()

const std::string & edsp::core::logger::default_name ( )
inlinestatic

Returns the name of the default logger.

Returns
Name or alias of the default logger.

◆ default_path()

const std::string & edsp::core::logger::default_path ( )
inlinestatic

Returns the current file path of the default logger.

An empty path means the the messages are printed directly into the console of the system.

Returns
Path of the file that is holding the messages from the default logger.

◆ level()

logger::levels edsp::core::logger::level ( )
inline

Returns the default level.

Returns
Current level that triggers the logger.

◆ name()

const std::string & edsp::core::logger::name ( ) const
inline

Returns the name of the logger.

Returns
Name of the logger

◆ operator<<() [1/14]

logger & edsp::core::logger::operator<< ( logger::logger_manipulator  manipulator)
inline

◆ operator<<() [2/14]

logger & edsp::core::logger::operator<< ( std::uint8_t  value)
inline

◆ operator<<() [3/14]

logger & edsp::core::logger::operator<< ( std::uint16_t  value)
inline

◆ operator<<() [4/14]

logger & edsp::core::logger::operator<< ( std::uint32_t  value)
inline

◆ operator<<() [5/14]

logger & edsp::core::logger::operator<< ( std::uint64_t  value)
inline

◆ operator<<() [6/14]

logger & edsp::core::logger::operator<< ( std::int8_t  value)
inline

◆ operator<<() [7/14]

logger & edsp::core::logger::operator<< ( std::int16_t  value)
inline

◆ operator<<() [8/14]

logger & edsp::core::logger::operator<< ( std::int32_t  value)
inline

◆ operator<<() [9/14]

logger & edsp::core::logger::operator<< ( std::int64_t  value)
inline

◆ operator<<() [10/14]

logger & edsp::core::logger::operator<< ( float  value)
inline

◆ operator<<() [11/14]

logger & edsp::core::logger::operator<< ( double  value)
inline

◆ operator<<() [12/14]

logger & edsp::core::logger::operator<< ( const char *  str)
inline

◆ operator<<() [13/14]

template<typename Char >
logger & edsp::core::logger::operator<< ( const std::basic_string< Char > &  str)
inline

◆ operator<<() [14/14]

template<typename Char >
logger & edsp::core::logger::operator<< ( const edsp::basic_string_view< Char > &  str)
inline

◆ set_default_level()

void edsp::core::logger::set_default_level ( logger::levels  type)
inlinestatic

Updates the minimum level to be logged.

Parameters
typeLevel that triggers the logger.

◆ set_default_name()

void edsp::core::logger::set_default_name ( const std::string &  name)
inlinestatic

Updates the name of the default logger.

Parameters
nameNew name or alias associated with the default logger.

◆ set_default_path()

void edsp::core::logger::set_default_path ( const std::string &  path)
inlinestatic

Updates the default file path of the file holding the default logger.

Parameters
pathPath of the file that will store the message from the default logger.

◆ set_level()

void edsp::core::logger::set_level ( logger::levels  type)
inline

Updates the minimum level to be logged.

Parameters
typeLevel that triggers the logger.

◆ set_pattern()

void edsp::core::logger::set_pattern ( const std::string &  pattern)
inlinestatic

Updates the pattern of the displayed messages.

Note
Check the documentation of the fmt library.

◆ space()

logger & edsp::core::logger::space ( )
inline

Writes an space character to the stream and returns a reference to the stream.

Returns
A reference to the stream.

◆ str()

std::string edsp::core::logger::str ( ) const
inline

Returns the current string buffer.

Returns
String buffer holding the message.

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