library/logger/logger.hh¶
Contains the logger class and macros, based on Kasper’s KLogger class.
- Date
- Created on: 18.11.2011
- Author
- Marco Haag marco.haag@kit.edu
Defines
-
LOGGER_UTILITY_MACROS_
¶
-
va_num_args
(...)¶
-
va_num_args_impl
(_1, _2, _3, _4, _5, N, ...)¶
-
macro_dispatcher
(func, ...)¶
-
macro_dispatcher_
(func, nargs)¶
-
macro_dispatcher__
(func, nargs)¶
-
COLOR_NORMAL
¶
-
COLOR_BRIGHT
¶
-
COLOR_FOREGROUND_RED
¶
-
COLOR_FOREGROUND_GREEN
¶
-
COLOR_FOREGROUND_YELLOW
¶
-
COLOR_FOREGROUND_BLUE
¶
-
COLOR_FOREGROUND_CYAN
¶
-
COLOR_FOREGROUND_WHITE
¶
-
COLOR_PREFIX
¶
-
COLOR_SUFFIX
¶
-
COLOR_SEPARATOR
¶
-
__DEFAULT_LOGGER
¶
-
__LOG_LOCATION
¶
-
__LOG_LOG_4
(I, L, M, O)¶
-
__LOG_LOG_3
(I, L, M)¶
-
__LOG_LOG_2
(L, M)¶
-
__LOG_LOG_1
(M)¶
-
__LOG_TRACE_2
(I, M)¶
-
__LOG_TRACE_1
(M)¶
-
__LOG_DEBUG_2
(I, M)¶
-
__LOG_DEBUG_1
(M)¶
-
__LOG_INFO_2
(I, M)¶
-
__LOG_INFO_1
(M)¶
-
__LOG_PROG_2
(I, M)¶
-
__LOG_PROG_1
(M)¶
-
__LOG_WARN_2
(I, M)¶
-
__LOG_WARN_1
(M)¶
-
__LOG_ERROR_2
(I, M)¶
-
__LOG_ERROR_1
(M)¶
-
__LOG_FATAL_2
(I, M)¶
-
__LOG_FATAL_1
(M)¶
-
__LOG_ASSERT_3
(I, C, M)¶
-
__LOG_ASSERT_2
(C, M)¶
-
__LOG_LOG_ONCE_3
(I, L, M)¶
-
__LOG_LOG_ONCE_2
(L, M)¶
-
__LOG_LOG_ONCE_1
(M)¶
-
__LOG_TRACE_ONCE_2
(I, M)¶
-
__LOG_TRACE_ONCE_1
(M)¶
-
__LOG_DEBUG_ONCE_2
(I, M)¶
-
__LOG_DEBUG_ONCE_1
(M)¶
-
__LOG_INFO_ONCE_2
(I, M)¶
-
__LOG_INFO_ONCE_1
(M)¶
-
__LOG_WARN_ONCE_2
(I, M)¶
-
__LOG_WARN_ONCE_1
(M)¶
-
__LOG_ERROR_ONCE_2
(I, M)¶
-
__LOG_ERROR_ONCE_1
(M)¶
-
__LOG_FATAL_ONCE_2
(I, M)¶
-
__LOG_FATAL_ONCE_1
(M)¶
-
LOGGER
(I, K)¶
-
LOG
(...)¶
-
LTRACE
(...)¶
-
LDEBUG
(...)¶
-
LINFO
(...)¶
-
LPROG
(...)¶
-
LWARN
(...)¶
-
LERROR
(...)¶
-
LFATAL
(...)¶
-
LASSERT
(...)¶
-
LOG_ONCE
(...)¶
-
LTRACE_ONCE
(...)¶
-
LDEBUG_ONCE
(...)¶
-
LINFO_ONCE
(...)¶
-
LPROG_ONCE
(...)¶
-
LWARN_ONCE
(...)¶
-
LERROR_ONCE
(...)¶
-
LFATAL_ONCE
(...)¶
-
namespace
scarab
¶ The standard scarab namespace.
-
class
logger
¶ - #include <logger.hh>
The scarab logger.
The usage and syntax is inspired by log4j. logger itself uses the log4cxx library if it was available on the system during compiling, otherwise it falls back to std::stream.
The logger output can be configured in a file specified with the environment variable LOGGER_CONFIGURATION (by default log4cxx.properties in the config directory).
In most cases the following macro can be used to instantiate a Logger in your code:
This is equivalent to:
For logging the following macros can be used. The source code location will then automatically included in the output:
Public Types
Public Functions
-
logger
(const char *name = 0)¶ Standard constructor assigning a name to the logger instance.
- Parameters
name
: The logger name.
-
logger
(const std::string &name)¶ This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
-
~logger
()¶
-
bool
IsLevelEnabled
(ELevel level) const¶ Check whether a certain log-level is enabled.
- Return
- Parameters
level
: The log level
-
void
SetLevel
(ELevel level) const¶ Set a logger’s minimum logging level
- Parameters
level
: The log level
-
void
SetGlobalLevel
(ELevel level) const¶ Set all loggers’ minimum logging level
- Parameters
level
: The log level
-
void
Log
(ELevel level, const std::string &message, const Location &loc = Location ())¶ Log a message with the specified level. Use the macro LOG(logger, level, message).
- Parameters
level
: The log level.message
: The message.loc
: Source code location (set automatically by the corresponding macro).
-
void
LogTrace
(const std::string &message, const Location &loc = Location ())¶ Log a message at TRACE level. Use the macro LTRACE(logger, message).
- Parameters
message
: The message.loc
: Source code location (set automatically by the corresponding macro).
-
void
LogDebug
(const std::string &message, const Location &loc = Location ())¶ Log a message at DEBUG level. Use the macro LDEBUG(logger, message).
- Parameters
message
: The message.loc
: Source code location (set automatically by the corresponding macro).
-
void
LogInfo
(const std::string &message, const Location &loc = Location ())¶ Log a message at INFO level. Use the macro LINFO(logger, message).
- Parameters
message
: The message.loc
: Source code location (set automatically by the corresponding macro).
-
void
LogProg
(const std::string &message, const Location &loc = Location ())¶ Log a message at PROG level. Use the macro PROG(logger, message).
- Parameters
message
: The message.loc
: Source code location (set automatically by the corresponding macro).
-
void
LogWarn
(const std::string &message, const Location &loc = Location ())¶ Log a message at WARN level. Use the macro LWARN(logger, message).
- Parameters
message
: The message.loc
: Source code location (set automatically by the corresponding macro).
-
void
LogError
(const std::string &message, const Location &loc = Location ())¶ Log a message at ERROR level. Use the macro LERROR(logger, message).
- Parameters
message
: The message.loc
: Source code location (set automatically by the corresponding macro).
Public Static Functions
-
void
SetColored
(bool flag)¶ Set whether colored text will be used
- Parameters
flag
: Bool determining whether colored text will be used
-
void
SetOutStream
(std::ostream *stream)¶ Set the ostream pointer used for standard output messages
- Parameters
stream
: Stream object for standard output
-
void
SetErrStream
(std::ostream *stream)¶ Set the ostream pointer used for standard error messages
- Parameters
stream
: Stream object for standard errors
Private Members
-
Private *
fPrivate
¶
-
-
class