Class RMGLog

Class Documentation

class RMGLog

A class for managing log messages.

This class manages log messages for printing on the screen

Author

Daniel Kollar

Author

Kevin Krninger

Version

1.0

Date

08.2008

Constructor and destructor

RMGLog()

Constructor.

Getters

static inline RMGLog::LogLevel GetLogLevel()

Returns the minimum log level for screen output.

Returns:

log level

static inline bool GetPrefix()

Returns true if the loglevel is prefixed to every message. Default: true

Setters

static inline void SetLogLevel(RMGLog::LogLevel loglevel)

Sets the minimum log level for screen output.

Parameters:

loglevel – log level

static inline void SetPrefix(bool flag)

Toggle if the loglevel is prefixed to every message.

static inline void SetInihibitStartupInfo(bool flag)

Toggle if a startup message is shown before the first log message.

Miscellaneous

template<typename T>
static void Out(RMGLog::LogLevel loglevel, const T &message)

Writes string to the screen log if the log level is equal or greater than the minimum

Parameters:
  • loglevel – loglevel for the current message

  • message – string to write to the screen log

template<typename T, typename ...Args>
static void Out(RMGLog::LogLevel loglevel, const T &msg_first, const Args&... args)
template<typename ...Args>
static void OutFormat(RMGLog::LogLevel loglevel, const std::string &fmt, const Args&... args)
template<typename T, typename ...Args>
static inline void Out(RMGLog::LogLevel loglevel, T &msg_first, Args... msg_other)
static void StartupInfo()

Writes startup information onto screen

static inline const std::string &GetVersion()
Returns:

string containing the version number

static bool SupportsColors(const std::ostream &os)
template<RMGLog::Ansi color, typename T>
static std::string Colorize(const T &msg, std::ostream &os, bool bold = false)
static inline bool HadWarning()
static inline bool HadError()

Public Types

enum LogLevel

Enumerator for the amount of details to put into the log

Values:

enumerator debug

Print everything, including debug info.

enumerator detail

Print all details of operation.

enumerator summary

Print only results summary, warnings, and errors.

enumerator warning

Print only warnings and errors.

enumerator error

Print only errors.

enumerator fatal

Print only errors, stop execution.

enumerator nothing

Print nothing.

enum Ansi

Values:

enumerator black
enumerator red
enumerator green
enumerator yellow
enumerator blue
enumerator magenta
enumerator cyan
enumerator grey
enumerator unspecified