Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On 08/07/2012 01:28 PM, Michael Meeks wrote:
On Tue, 2012-08-07 at 09:23 +0200, Stephan Bergmann wrote:
   Use SAL_INFO/SAL_WARN for permanent warning code (see
<http://wiki.documentfoundation.org/Development#Assertions_and_Logging>), and
use SAL_DEBUG for temporary debug output (that the LO git commit hooks
will prevent from accidentally becoming permanent).

        I always use fprintf and never these other things. I can never remember
how to make SAL_WARN / SAL_INFO / SAL_DEBUG to actually output something
and grok their prefix behaviour etc.; on the occasions I've tried adding
one of those I inevitably have to do 2x compilation loops before giving
up and using fprintf - IIRC you have to use some different compile
flags, and/or set some also-difficult-to-remember environment variable
to some value - right ?

No, not for SAL_DEBUG. (SAL_WARN requires an --enable-dbgutil build, but which developer doesn't do that, anyway? SAL_INFO requires SAL_LOG=+WARN+INFO, but that's on purpose, to keep the default amount of output manageable.)

        fprintf (stderr,"foo\n");

        goes directly, atomically to your terminal pausing the app until it's
out and it -just-works- (TM) ;-)

As does SAL_DEBUG (modulo the "pausing the app," which fprintf doesn't do either, at least not in a multithreaded process), with the added benefit that it is way simpler to output an OUString s with:

fprintf(stderr, "%s", OUStringToOString(s, RTL_TEXTENCODING_UTF8).getStr());

vs. just

  SAL_DEBUG(s);

Stephan

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.