log Namespace Reference

Space-ng SDK: sol3::log Namespace Reference
Space-ng SDK
sol3::log Namespace Reference

Namespaces

 details
 

Classes

class  ExceptionBase
 
class  ContractViolation
 
class  InvalidResource
 

Functions

std::string defaultLogPattern ()
 
std::shared_ptr< spdlog::logger > setupDefaultLogger (std::string const &name, std::vector< spdlog::sink_ptr > sinks={})
 
std::shared_ptr< spdlog::logger > getLogger (std::string const &name, std::vector< spdlog::sink_ptr > sinks={})
 

Function Documentation

◆ defaultLogPattern()

std::string sol3::log::defaultLogPattern ( )

This function returns the default spdlog pattern that should be used by all loggers. https://github.com/gabime/spdlog/wiki/3.-Custom-formatting TODO support setting the default log pattern at program setup.

◆ getLogger()

std::shared_ptr<spdlog::logger> sol3::log::getLogger ( std::string const &  name,
std::vector< spdlog::sink_ptr >  sinks = {} 
)

Prefer this function to spdlog::get(name). This returns a logger with the given name, and initializes it if it doesn't yet exist. This logger will inherit sinks from the default logger, and also append the provided sinks.

◆ setupDefaultLogger()

std::shared_ptr<spdlog::logger> sol3::log::setupDefaultLogger ( std::string const &  name,
std::vector< spdlog::sink_ptr >  sinks = {} 
)

Setup the default logger for the application. Name here should be your application name. This function will only setup the default logger exactly once, and should be called from the beginning of your program before other calls to getLogger(name), or SPDLOG_ functions. The provided sinks will be inherited by all loggers.