jigdo API
Logger Class Reference
Usually created by the DEBUG_UNIT macro, with an instance name of "debug"- an object which can be called to output debugging info.
#include <log.hh>

Public Member Functions | |
Logger (const char *unitName, bool enabled=false) | |
Register a compilation unit. | |
bool | enabled () const |
operator bool () const | |
const char * | name () const |
void | operator() (const char *format) const |
void | operator() (const char *format, Subst a) const |
void | operator() (const char *format, Subst a, Subst b) const |
void | operator() (const char *format, Subst a, Subst b, Subst c) const |
void | operator() (const char *format, Subst a, Subst b, Subst c, Subst d) const |
void | operator() (const char *format, Subst a, Subst b, Subst c, Subst d, Subst e) const |
void | operator() (const char *format, Subst a, Subst b, Subst c, Subst d, Subst e, Subst f) const |
void | operator() (const char *format, Subst a, Subst b, Subst c, Subst d, Subst e, Subst f, Subst g) const |
void | operator() (const char *format, Subst a, Subst b, Subst c, Subst d, Subst e, Subst f, Subst g, Subst h) const |
void | operator() (const char *format, Subst a, Subst b, Subst c, Subst d, Subst e, Subst f, Subst g, Subst h, Subst i) const |
Static Public Member Functions | |
static void | defaultPut (const string &unitName, unsigned char unitNameLen, const char *format, int args, const Subst arg[]) |
Default output function prints to stderr. | |
static void | setOutputFunction (OutputFunction *newOut) |
Replace the output function. | |
static bool | setEnabled (const char *unitName, bool enable=true) |
Enable/disable messages for specific units. | |
static Logger * | enumerate (Logger *l=0) |
Walk through list of registered Logger objects. | |
static void | scanOptions (const string &s, const char *binName) |
Scan value of the --debug cmd line option. |
Detailed Description
Usually created by the DEBUG_UNIT macro, with an instance name of "debug"- an object which can be called to output debugging info.
Constructor & Destructor Documentation
Logger::Logger | ( | const char * | unitName, | |
bool | enabled = false | |||
) |
Register a compilation unit.
All Loggers MUST *MUST* be static objects! unitName must remain valid during the lifetime of all Loggers, best make it a string constant.
Member Function Documentation
void Logger::defaultPut | ( | const string & | unitName, | |
unsigned char | unitNameLen, | |||
const char * | format, | |||
int | args, | |||
const Subst | arg[] | |||
) | [static] |
static void Logger::setOutputFunction | ( | OutputFunction * | newOut | ) | [inline, static] |
bool Logger::enabled | ( | ) | const [inline] |
Referenced by loggerInit(), and operator()().
Logger::operator bool | ( | ) | const [inline] |
const char* Logger::name | ( | ) | const [inline] |
Referenced by loggerInit(), and scanOptions().
bool Logger::setEnabled | ( | const char * | unitName, | |
bool | enable = true | |||
) | [static] |
Enable/disable messages for specific units.
By default, messages are disabled.
- Parameters:
-
unitName Name, or null for all units enable true to enable, false to disable
- Returns:
- true if successful (i.e. unit exists)
References enabledVal, next, and unitNameVal.
Referenced by loggerInit(), main(), and scanOptions().
Walk through list of registered Logger objects.
Call without arg to start, then call with returned value til 0 is returned: Logger* l = Logger::enumerate(); while (l != 0) { cerr << ' ' << l->name(); l = Logger::enumerate(l); }
Referenced by loggerInit(), and scanOptions().
void Logger::operator() | ( | const char * | format | ) | const [inline] |
References enabled().
References enabled().
References enabled().
References enabled().
void Logger::operator() | ( | const char * | format, | |
Subst | a, | |||
Subst | b, | |||
Subst | c, | |||
Subst | d, | |||
Subst | e | |||
) | const [inline] |
References enabled().
void Logger::operator() | ( | const char * | format, | |
Subst | a, | |||
Subst | b, | |||
Subst | c, | |||
Subst | d, | |||
Subst | e, | |||
Subst | f | |||
) | const [inline] |
References enabled().
void Logger::operator() | ( | const char * | format, | |
Subst | a, | |||
Subst | b, | |||
Subst | c, | |||
Subst | d, | |||
Subst | e, | |||
Subst | f, | |||
Subst | g | |||
) | const [inline] |
References enabled().
void Logger::operator() | ( | const char * | format, | |
Subst | a, | |||
Subst | b, | |||
Subst | c, | |||
Subst | d, | |||
Subst | e, | |||
Subst | f, | |||
Subst | g, | |||
Subst | h | |||
) | const [inline] |
References enabled().
void Logger::operator() | ( | const char * | format, | |
Subst | a, | |||
Subst | b, | |||
Subst | c, | |||
Subst | d, | |||
Subst | e, | |||
Subst | f, | |||
Subst | g, | |||
Subst | h, | |||
Subst | i | |||
) | const [inline] |
References enabled().
void Logger::scanOptions | ( | const string & | s, | |
const char * | binName | |||
) | [static] |
Scan value of the --debug cmd line option.
It is either missing (empty) or a comma-separated list of words (we also allow spaces). Each word can be preceded by a '~' for negation (i.e. disable debug messages rather than enable them). The word is the name of a compilation unit, or one of the special values "all" or "help".
References _, enumerate(), name(), setEnabled(), and subst.
Referenced by cmdOptions(), and main().
The documentation for this class was generated from the following files:
Generated on Tue Sep 23 14:27:42 2008 for jigdo by
