OSVR-Core  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
osvr::util::log::Logger Class Reference

An object allowing you to log messages with a given log source name. More...

#include <osvr/Util/Logger.h>

Classes

class  StreamProxy
 

Public Member Functions

 Logger (std::string const &name, std::shared_ptr< spdlog::logger > logger, PrivateConstructor *)
 
 Logger (const Logger &)=delete
 Non-copyable.
 
Loggeroperator= (const Logger &)=delete
 Non-copy-assignable.
 
 ~Logger ()
 Destructor.
 
LogLevel getLogLevel () const
 
void setLogLevel (LogLevel level)
 
void flushOn (LogLevel level)
 Set the log level at which this logger will trigger a flush.
 
StreamProxy log (LogLevel level, const char *msg)
 
StreamProxy log (LogLevel level)
 logger.log(log_level) << "msg" call style
 
void flush ()
 Make sure this logger has written out its data.
 
std::string const & getName () const
 Get the logger name.
 
logger->info(msg) (with optional << "more message") call

style

StreamProxy trace (const char *msg)
 
StreamProxy debug (const char *msg)
 
StreamProxy info (const char *msg)
 
StreamProxy notice (const char *msg)
 
StreamProxy warn (const char *msg)
 
StreamProxy error (const char *msg)
 
StreamProxy critical (const char *msg)
 
logger->info() << "msg" call style
StreamProxy trace ()
 
StreamProxy debug ()
 
StreamProxy info ()
 
StreamProxy notice ()
 
StreamProxy warn ()
 
StreamProxy error ()
 
StreamProxy critical ()
 

Static Public Member Functions

static LoggerPtr makeFromExistingImplementation (std::string const &name, std::shared_ptr< spdlog::logger > logger)
 
static LoggerPtr makeWithSink (std::string const &name, spdlog::sink_ptr sink)
 
static LoggerPtr makeWithSinks (std::string const &name, spdlog::sinks_init_list sinks)
 

Detailed Description

An object allowing you to log messages with a given log source name.

Implemented as a wrapper around the spdlog::logger class.

Definition at line 67 of file Logger.h.

Constructor & Destructor Documentation

osvr::util::log::Logger::Logger ( std::string const &  name,
std::shared_ptr< spdlog::logger >  logger,
PrivateConstructor *   
)

Internal-use constructor - please used a factory/named constructor.

Member Function Documentation

static LoggerPtr osvr::util::log::Logger::makeFromExistingImplementation ( std::string const &  name,
std::shared_ptr< spdlog::logger >  logger 
)
static

Create from existing spdlog (implementation) logger.

Always returns a valid pointer even on invalid input, though it may be a "fallback" logger.

static LoggerPtr osvr::util::log::Logger::makeWithSink ( std::string const &  name,
spdlog::sink_ptr  sink 
)
static

Construct with a name and an existing, single spdlog sink. (Does not use any logger registry.)

Always returns a valid pointer even on invalid input, though it may be a "fallback" logger.

static LoggerPtr osvr::util::log::Logger::makeWithSinks ( std::string const &  name,
spdlog::sinks_init_list  sinks 
)
static

Construct with a name and an initializer list of existing spdlog sinks. (Does not use any logger registry.)

Always returns a valid pointer even on invalid input, though it may be a "fallback" logger.

LogLevel osvr::util::log::Logger::getLogLevel ( ) const

Get the minimum level at which this logger will actually forward messages on to the sinks.

void osvr::util::log::Logger::setLogLevel ( LogLevel  level)

Set the minimum level at which this logger will actually forward messages on to the sinks.

StreamProxy osvr::util::log::Logger::log ( LogLevel  level,
const char *  msg 
)

logger.log(log_level, msg) (with optional << "more message") call style


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