#include <Logger.h>
Static Public Member Functions | |
static QPID_MESSAGING_EXTERN void | configure (int argc, const char *argv[], const std::string &prefix=std::string()) |
static QPID_MESSAGING_EXTERN std::string | usage () |
static QPID_MESSAGING_EXTERN void | setOutput (LoggerOutput &output) |
static QPID_MESSAGING_EXTERN void | log (Level level, const char *file, int line, const char *function, const std::string &message) |
A utility class to allow the application to control the logging output of the qpid messaging library
This class represents a singleton logging facility within the qpid messaging library so there are only static methods in the class
|
static |
Configure the logging subsystem
This function takes an array of text options (which could easily come from a programs command line) and uses them to configure the logging subsystem.
If the prefix parameter is specified then the accepted command line options are prefixed by <<prefix>>- for example if the prefix is "qpid" then the options all start "--qpid-log..."
Accepted options are: –log-enable RULE –log-disable RULE
Both –log-enable and –log-disable can be specified multiple times in a single command line. The enables are acted upon and after them the disables are acted upon.
RULE is in the form LEVEL[("+"|"-")][:PATTERN] LEVEL is one of "trace", "debug", "info", "notice", "warning", "error", "critical" "+" operates on the level and all higher levels "-" operates on the level and all lower levels PATTERN is a category name or a fragment of a fully namespace qualified function (Case sensitive).
–log-to-stdout ("on"|"off|"0"|"1") --log-to-stderr ("on"|"off|"0"|"1") –log-to-file FILENAME
These options control where the qpid logging subsystem sends log messages
–log-time ("on"|"off|"0"|"1") --log-level ("on"|"off|"0"|"1") –log-source ("on"|"off|"0"|"1") --log-thread ("on"|"off|"0"|"1") –log-function ("on"|"off|"0"|"1") --log-hires-timestamp ("on"|"off|"0"|"1")
These options control what information is included in the logging message sent by the logging subsystem.
argc | count of options - identical to meaning for main(). |
argv | array of pointers to options - identical to meaning for main(). |
prefix | (optional) If present prefix all logging options with this string |
MessagingException | if it cannot parse an option it recognises |
|
static |
Output a log message. This will get sent to all the specified logging outputs including any the application has registered. The message will get filtered along with the internal messages according to the specified logging filters.
When a log message output using log() is received by a LoggerOutput::log() method the "user" bool parameter will be set true.
|
static |
Register a custom handler for log messages
This allows application programs to intercept the log messages coming from qpid::messaging and handle them in whatever way is consonent with the applications own handling of log messages.
In order to do this create a class that inherits from qpid::messaging::LoggerOutput and override the log() member function.
|
static |
Get a user friendly usage message.
This returns a usage message that is suitable for outputting directly to a console user. The message only contains the command line options that are understood by qpid::messaging::Logger::configure().
NB. You must call qpid::messaging::Logger::configure() before calling this to populate the usage string as the usage string depends on the prefix that is passed in to qpid::messaging::Logger::configure().