Logging

From Olympus
Jump to: navigation, search

Olympus provides a standardized logging feature, logging functions are described in libOlympusUtility. Olympus components should make of these.

Contents

Logging Streams

Olympus modules are instrumented to generate various logging streams. You can select which stream to log by modifying the .cfg file for the a given module. Note that not all modules generate all streams, but GXI, CTH and AGN are typically always present. Look through some code to get an idea of what goes into given streams. The following is a list of standard streams:

// D: defines for the predefined (always on) logging streams
#define ERROR_STREAM "ERR" 
#define WARNING_STREAM "WAR"
#define FATALERROR_STREAM "FATAL_ERROR"

// D: the core thread logging stream
#define GALAXY_STREAM "GXI"
#define CORETHREAD_STREAM "CTH"
#define REGISTRY_STREAM "REG"
#define ACTIONRECEIVER_STREAM "ACR"
#define INTERACTIONCONTROLLER_STREAM "ICT"
#define INTERACTIONSTATEMONITOR_STREAM "ISM"
#define SENSORS_STREAM "SEN"
#define EFFECTORS_STREAM "EFF"
#define AGENTS_STREAM "AGN"


Logging Interface

The logging functions provide the following API.

InitializeLogging

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

Start logging to the given log file with the given verbosity level (see below).

Log

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

Send the message (in sprintf format) to the stream specified.

CloseLogging

void Olympus::CloseLogging()

Close the log file.

Verbosity

typedef enum {NoDisplay, StdOnly, All} Olympus::Verbosity
NoDisplay logging should go to the log file but not to the stdout.
StdOnly logging should go to stdout but not to the log file.
All 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

Personal tools