| STATIC METHODS
| STATIC DATA
| STATIC METHODS
| STATIC DATA
:: rtl ::
- Base Classes
- Known Derived Classes
- The intended use for class Logfile is to write time stamp information
for profiling purposes.
Profiling output should only be generated for a special product version of OpenOffice
which is compiled with a defined preprocessor symbol 'TIMELOG'.
Therefore we have provided a set of macros that uses the class Logfile only if
this symbol is defined. If the macros are not sufficient, i.e. you need more
then three arguments for a printf style message, then you have to insert an
#ifdef TIMELOG/#endif brace yourself.
Additionally the environment variable RTL_LOGFILE has to be defined in order to generate
logging information. If the variable is not empty, it creates a file with the name
$(RTL_LOGFILE)_$(PID).log, where $(PID) is the process id of the running process.
It can be used as a run time switch for enabling or disabling the logging.
Note that this variable is evaluated only once at the first attempt to write a message.
The class LogFile collects runtime data within its constructor and destructor. It can be
used for timing whole functions.
If you want to write timing data without context you can use the RTL_LOGFILE_TRACE-macros
which are defined inside .
The class LogFile should not be used directly, instead use the RTL_LOGFILE_CONTEXT/
RTL_LOGFILE_CONTEXT( instance, name );
This macro creates an instance of class LogFile with the name "instance" and writes the current time,
thread id and "name" to the log file.
Example: RTL_LOGFILE_CONTEXT( aLog, "Timing for foo-method" );
RTL_LOGFILE_CONTEXT_TRACE( instance, mesage );
RTL_LOGFILE_CONTEXT_TRACEn( instance, frmt, arg1, .., arg3 );
These macros can be used to log information in a "instance" context. The "instance" object
is used to log message informations. All macros with "frmt" uses printf notation to log timing infos.
Example: RTL_LOGFILE_CONTEXT_TRACE( aLog, "Now we call an expensive function" );
RTL_LOGFIlE_CONTEXT_TRACE1( aLog, "Config entries read: %u", (unsigned short)i );
RTL_LOGFILE_TRACE( string );
RTL_LOGFILE_TRACEn( frmt, arg1, .., arg3 );
These macros can be used to log information outside a context. The macro directly calls
rtl_logfile_trace to write the info to the log file. All macros with "frmt" uses printf
notation to log timing infos.
Example: RTL_LOGFILE_TRACE( "Timing for loading a file" );
RTL_LOGFILE_TRACE1( aLog, "Timing for loading file: %s", aFileName );
The lines written to the log file consist of the following space separated elements:
1. The time relative to the start of the global timer in milliseconds. The times is
started typically for the first logged line.
2. Thread id. It's absolut value is probably of less interest than providing a way to
distinguish different threads.
3. a. An opening or closing curly brace indicating the start or end of a scope.
4a. Function name or general scope identifier.
b. A vertical line indicating an arbitrary message.
4b optional function name or general scope identifier.
5b A colon followed by a space and a free form message terminated by a newline.
There is a second version of creating a context. RTL_LOGFILE_CONTEXT_AUTHOR takes
two more arguments, the name of the project and the author's sign who is responsible
for the code in which the macro is used.
Logfile( const sal_Char * name );
Logfile( const sal_Char * project, const sal_Char * author, const sal_Char * name );
|const sal_Char *
Top of Page
Copyright © 2012, The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache, the Apache feather logo, Apache OpenOffice and OpenOffice.org are trademarks of The Apache Software Foundation. Other names may be trademarks of their respective owners.