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. | |
Logger & | operator= (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) |
An object allowing you to log messages with a given log source name.
Implemented as a wrapper around the spdlog::logger class.
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.
|
static |
Create from existing spdlog (implementation) logger.
Always returns a valid pointer even on invalid input, though it may be a "fallback" logger.
|
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 |
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