DCMTK
Version 3.6.5
OFFIS DICOM Toolkit
|
This module contains classes which are used for logging purposes. This library is based on log4cplus.
The main classes are (in alphabetical order):
The following files provide sample configurations and further documentation:
The following example shows how to use oflog in a console application.
First we need the necessary headers and definitions:
That is all that is necessary to create log statements. You can now use any of the following macros to generate log entries:
While the above code works by itself, the result is not nice and flexible. To configure oflog with the help of OFCommandLine, you can do something like this:
After you called OFConsoleApplication::parseCommandLine(), oflog can be set up with one single call:
This is all that is necessary to configure the logger and have options like –verbose
and –log-config
available.
Alternatively you can use OFLog::configure(), but this approach doesn't offer the flexibility of –log-level
and –log-config
.
The default pattern for the log messages is "%P: %m%n", i.e. first character of the log level (e.g. "D" for debug or "E" for error), a colon, the message and a line break.