Logging

From MantidProject

Jump to: navigation, search

The Mantid logging system is a useful tool for garnering more information about the operation of the program. It is used to output messages from the framework to a channel, for example a file or the screen. Including calls to the logging system in your code can greatly aid in assessing its running - successful or otherwise.

Logging levels

There are five logging levels, by which the importance of a message can be differentiated. A logging channel can be configured (in the configuration file) to only output messages at or above a certain priority level.

Level Description
FATAL A fatal error. The application will most likely terminate. This is the highest priority.
ERROR An error. An operation did not complete successfully, but the application as a whole is not affected.
WARNING A warning. An operation completed with an unexpected result.
INFORMATION An informational message, usually denoting the successful completion of an operation.
DEBUG A debugging message.This is the lowest priority.

Usage

Examples of sending a message to the logging framework are:

g_log.warning("Something didn't work");
g_log.information() << "Flightpath found to be " << distance << " metres." << std::endl;

In the above, g_log is a class's logging object and distance is a variable holding the appropriate value.

Full details can be found in the documentation for the Logger class

Configuration options

To follow....

Personal tools
Create a book