Logging

From Olympus

Jump to: navigation, search

For a standardized logging functionality, Olympus provides logging functions in libOlympusUtility, which Olympus components are encouraged to make use of. The logging functions provide the following API.

Contents

Verbosity

typedef enum {NoDisplay, StdOnly, All} Olympus::Verbosity
  • NoDisplay means that logging should go to the log file but not to the stdout.
  • StdOnly means that logging should go to stdout but not to the log file.
  • All means that logging should go to both stdout and the log file.

Streams

#define STD_STREAM 0
#define DBG_STREAM 1
#define ERR_STREAM 2

The DBG_STREAM messages are printed to the console only if verbosity is set to All

InitializeLogging

void Olympus::InitializeLogging(const char* logfile, Olympus::Verbosity verbosity)

Start logging to the given log file with the given verbosity level.

Log

void Olympus::Log(int stream, const char* message, ...)

Log the message (in sprintf format) to the given stream.

CLoseLogging

void Olympus::CloseLogging()

Close the log file.