[Libreoffice] [LibreOffice][Patch] Replace ASSERT and DBG_ASSERT with OSL_ENSURE + some translations, comment removal

David Tardon dtardon at redhat.com
Fri Oct 15 04:44:34 PDT 2010

On Thu, Oct 14, 2010 at 09:11:26AM +0100, Caolán McNamara wrote:
> On Wed, 2010-10-13 at 22:34 +0200, Jacek Wolszczak wrote:
> > http://wiki.services.openoffice.org/wiki/Debug_Levels. 
> > 
> > Some additional questions. What should I replace DBG_ERROR with?
> Hmm, DBG_ERROR takes no condition, and just a message, I suggest that 
> DBG_ERROR("horrible failure");
> can become
> OSL_ENSURE(false, "horrible failure");

Yeah, that's the path I've taken in the past. Additionally, I suggest to
turn both DBG_WARNING and DBG_TRACE (not that I remember ever seeing
either of them :) into OSL_TRACE.

> > Should RTL_LOGFILE_CONTEXT_AUTHOR as in http://bit.ly/buiBlA be updated
> > somehow as it contains a lot of hardcoded e-mail addresses?
> *shrug*, nah, leave 'em alone I suggest.

Given the description of rtl::Logfile:

"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 <rtl/logfile.h>.

The class LogFile should not be used directly, instead use the RTL_LOGFILE_CONTEXT/

, I suggest to scrap them entirely. There are far better ways to profile
code, like gprof or callgrind (esp. combined with kcachegrind).

OT: This comment

// POLICY: Don't use RTL_LOGFILE_PRODUCT_* for your personal logging information.
//         Be aware that these logs make it into the product shipped to customers.
//         If you have good reasons for doing this, please contact product management.

really amused me :)


More information about the LibreOffice mailing list