OSVR-Core
|
An object allowing you to log messages with a given log source name. More...
#include <Logger.h>
Classes | |
class | StreamProxy |
An object returned the logging functions (including operator<<), serves to accumulate streamed output in a single ostringstream then write it to the logger at the end of the expression's lifetime. More... | |
Public Member Functions | |
Logger (std::string const &name, std::shared_ptr< spdlog::logger > logger, PrivateConstructor *) | |
Internal-use constructor - please used a factory/named constructor. More... | |
Logger (const Logger &)=delete | |
Non-copyable. | |
Logger & | operator= (const Logger &)=delete |
Non-copy-assignable. | |
OSVR_UTIL_EXPORT | ~Logger () |
Destructor. | |
OSVR_UTIL_EXPORT LogLevel | getLogLevel () const |
Get the minimum level at which this logger will actually forward messages on to the sinks. More... | |
OSVR_UTIL_EXPORT void | setLogLevel (LogLevel level) |
Set the minimum level at which this logger will actually forward messages on to the sinks. More... | |
OSVR_UTIL_EXPORT void | flushOn (LogLevel level) |
Set the log level at which this logger will trigger a flush. | |
OSVR_UTIL_EXPORT StreamProxy | log (LogLevel level, const char *msg) |
logger.log(log_level, msg) (with optional << "more message") call style | |
OSVR_UTIL_EXPORT StreamProxy | log (LogLevel level) |
logger.log(log_level) << "msg" call style | |
OSVR_UTIL_EXPORT 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 | |
OSVR_UTIL_EXPORT StreamProxy | trace (const char *msg) |
OSVR_UTIL_EXPORT StreamProxy | debug (const char *msg) |
OSVR_UTIL_EXPORT StreamProxy | info (const char *msg) |
OSVR_UTIL_EXPORT StreamProxy | notice (const char *msg) |
OSVR_UTIL_EXPORT StreamProxy | warn (const char *msg) |
OSVR_UTIL_EXPORT StreamProxy | error (const char *msg) |
OSVR_UTIL_EXPORT StreamProxy | critical (const char *msg) |
logger->info() << "msg" call style | |
OSVR_UTIL_EXPORT StreamProxy | trace () |
OSVR_UTIL_EXPORT StreamProxy | debug () |
OSVR_UTIL_EXPORT StreamProxy | info () |
OSVR_UTIL_EXPORT StreamProxy | notice () |
OSVR_UTIL_EXPORT StreamProxy | warn () |
OSVR_UTIL_EXPORT StreamProxy | error () |
OSVR_UTIL_EXPORT StreamProxy | critical () |
Static Public Member Functions | |
static OSVR_UTIL_EXPORT LoggerPtr | makeFromExistingImplementation (std::string const &name, std::shared_ptr< spdlog::logger > logger) |
Create from existing spdlog (implementation) logger. More... | |
static OSVR_UTIL_EXPORT LoggerPtr | makeWithSink (std::string const &name, spdlog::sink_ptr sink) |
Construct with a name and an existing, single spdlog sink. More... | |
static OSVR_UTIL_EXPORT LoggerPtr | makeWithSinks (std::string const &name, spdlog::sinks_init_list sinks) |
Construct with a name and an initializer list of existing spdlog sinks. More... | |
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.
LogLevel osvr::util::log::Logger::getLogLevel | ( | ) | const |
Get the minimum level at which this logger will actually forward messages on to the sinks.
|
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.
void osvr::util::log::Logger::setLogLevel | ( | LogLevel | level | ) |
Set the minimum level at which this logger will actually forward messages on to the sinks.