Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

Quick User Guide

1. The 5 basic macros

In a single threaded application, you will probably want to use the 5 basic macros.

1.1 Initializing the trace mechanism.

call this macro only once : first line in main()
     LOB_TRACE_INIT("lobtracestream.ini", "myapp_");

1.2 Entering and leaving a function/method

     LOB_TRACE_ENTRY(UTILS, "MyClass::getValue(int i)");
     LOB_TRACE_RETURN(UTILS, "MyClass::getValue(int)", retCode);

1.3 Tracing...

     LOB_TRACE(UTILS, DEBUG) << "Hello world, i = " << i << lt_endl; // soon : endl;

1.4 Trowing a traced exception

use this instead of 'throw'
     LOB_EXCEPTION(LobTraceException::bad_value, "negative counter exception");

2. The 5 multi-trace/multi-thread macros

In a multi-threaded application, you will need to use 5 other macros.
Version 1.1.x has no mutual exclusion mechanism allowing to log all thread traces in a single file (this because I don't know yet what mutex works on both Unix & M$ Windows).
Therefore, you will have to instanciate one LobTraceProvider and one LobTraceStream per thread.
The following macros are very similar to the basic macros: They have just one more parameter to specify which provider/stream is meant.
     LobTraceProvider g_LTProvider2;
     LobTraceStream   g_LTStream2(&g_LTProvider2);

2.1 Initializing the trace mechanism.

Call this macro only once, but for each LobTraceProvider
     LOB_TRACE_INIT_MT(g_LTProvider2, "lobtracestream.ini", "myapp_");

2.2 Entering and leaving a function/method

     LOB_TRACE_ENTRY_MT(g_LTStream2, UTILS, "MyClass::getValue(int i)");
     LOB_TRACE_RETURN_MT(g_LTStream2, UTILS, "MyClass::getValue(int)", retCode);

2.3 Tracing...

     LOB_TRACE_MT(g_LTStream2, UTILS, DEBUG) << "Hello world, i = " << i << lt_endl;

2.4 Trowing a traced exception

use this instead of 'throw'
     LOB_EXCEPTION_MT(g_LTStream2, bad_value, "negative counter exception");

3. Writing the Trace configuration file

The LobTrace configuration file is read at trace initialization (commonly: at the application startup).
It contains (optional) trace configuration variables and the TraceLevels for each of your modules.

Variables

LogDirectory Path to where the log files will be stored.
LogFileMaxLines logFile size limit, a new file is created when reached.
LogFilePrefix Filename prefix for logFiles
LogFileExt Filename extension for logFiles
TraceInXML logFile content is in XML

    LogDirectory    = "./Log"
    LogFileMaxLines = "1000"
    LogFilePrefix   = "myApp_"
    LogFileExt      = ".xml"
    TraceInXML      = "yes"

Modules

Trace Levels are: INOUT, TRACE, DEBUG, WARNING, ERROR, CRITICAL and EXCEPTION

If tracelevel is set to WARNING,
then all traces arriving with level WARNING, ERROR, CRITICAL and EXCEPTION are logged.
INOUT, TRACE and DEBUG are rejected.

    GENERAL    = "WARNING"
    UTILS      = "DEBUG"
    DEMOMODULE = "TRACE"
    ...


Generated on Sun Dec 15 23:17:22 2002 for LobTraceStream by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001