Class sdm::Logger

Class List > sdm > Logger

The main logger. This logger will print logs with a given format on the output stream.

  • #include <logger.hpp>

Inherits the following classes: sdm::BaseLogger

Inherited by the following classes: sdm::FileLogger, sdm::StdLogger

Public Functions

Type Name
Logger ()
Logger (std::ostream * os, const std::string & format="")
Logger (std::shared_ptr< std::ostream > os, const std::string & format="")
void log (TData... vals)
Record values.
void setFormat (const std::string & format)
Set the format of logs.

Public Functions inherited from sdm::BaseLogger

See sdm::BaseLogger

Type Name
void log (TData... vals)
Record values.

Protected Attributes

Type Name
std::string format_
the output format
std::shared_ptr< std::ostream > output_stream_
the output stream for logs.

Public Functions Documentation

function Logger [1/3]

inline sdm::Logger::Logger () 

function Logger [2/3]

inline sdm::Logger::Logger (
    std::ostream * os,
    const std::string & format=""
) 

function Logger [3/3]

inline sdm::Logger::Logger (
    std::shared_ptr< std::ostream > os,
    const std::string & format=""
) 

function log

template<class... TData>
inline void sdm::Logger::log (
    TData... vals
) 

Template parameters:

  • TData... the types of input values

Parameters:

  • vals the values to log

function setFormat

inline void sdm::Logger::setFormat (
    const std::string & format
) 

Use {} each time a value must be added.

Example:

Logger logger;
logger.setFormat("#> Here, I print my results : result1={}, result2={}");

Parameters:

  • format the format as a string.

Protected Attributes Documentation

variable format_

std::string sdm::Logger::format_;

variable output_stream_

std::shared_ptr<std::ostream> sdm::Logger::output_stream_;

The documentation for this class was generated from the following file src/sdm/utils/logging/logger.hpp