OSVR-Core
Namespaces | Typedefs | Functions
Log.h File Reference

Header for basic internal log reference. More...

#include <osvr/Util/Export.h>
#include <osvr/Util/SharedPtr.h>
#include <osvr/Util/UniquePtr.h>
#include <string>

Go to the source code of this file.

Namespaces

 osvr
 The main namespace for all C++ elements of the framework, internal and external.
 
 osvr::util
 The Util library: Functionality not necessarily coupled to any particular core library, serving more as a common base layer behind all systems.
 

Typedefs

typedef shared_ptr< Logger > osvr::util::log::LoggerPtr
 

Functions

OSVR_UTIL_EXPORT bool osvr::util::log::tryInitializingLoggingWithBaseName (std::string const &baseName)
 Attempt to initialize the logging system with the indicated base filename (will be stripped of all characters outside of [a-zA-Z0-9_]). More...
 
OSVR_UTIL_EXPORT LoggerPtr osvr::util::log::make_logger (const std::string &logger_name)
 Make (or get from the registry) a logger by name. More...
 
OSVR_UTIL_EXPORT void osvr::util::log::drop (const std::string &logger_name)
 Drops a logger from the registry. More...
 
OSVR_UTIL_EXPORT void osvr::util::log::dropAll ()
 Removes all the registered loggers from the registry. More...
 
OSVR_UTIL_EXPORT void osvr::util::log::flush ()
 For implementations with a centralized logger registry, flush all logger sinks. More...
 
OSVR_UTIL_EXPORT std::string osvr::util::log::getLoggingDirectory (bool make_dir=false)
 

Detailed Description

Header for basic internal log reference.

To actually log to the produced loggers, include <osvr/Util/Logger.h>

Date
2016
Author
Sensics, Inc. http://sensics.com

Function Documentation

§ drop()

void osvr::util::log::drop ( const std::string &  logger_name)

Drops a logger from the registry.

The logger will survive until the last copy of it is destroyed (e.g., goes out of scope). This function is useful if you want to destroy a logger before the program terminates.

§ dropAll()

void osvr::util::log::dropAll ( )

Removes all the registered loggers from the registry.

Each logger will survive until the last copy of it is destroyed (e.g., goes out of scope).

§ flush()

void osvr::util::log::flush ( )

For implementations with a centralized logger registry, flush all logger sinks.

§ make_logger()

LoggerPtr osvr::util::log::make_logger ( const std::string &  logger_name)

Make (or get from the registry) a logger by name.

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

Todo:
use custom OSVR logger that splits output to STDOUT and STDERR and log files based on severity levels, etc.
Todo:
use custom OSVR logger that splits output to STDOUT and STDERR and log files based on severity levels, etc.

§ tryInitializingLoggingWithBaseName()

bool osvr::util::log::tryInitializingLoggingWithBaseName ( std::string const &  baseName)

Attempt to initialize the logging system with the indicated base filename (will be stripped of all characters outside of [a-zA-Z0-9_]).

If it succeeds (because you called it before any logging calls occurred), it returns true.

Not typically needed, since the log file will usually be named using a sanitized version of the executable file name's stem, but provided just in case that's not a reasonable default.