[Libreoffice] SAL_INFO usage (was: [Libreoffice-commits] .: writerfilter/source)

Stephan Bergmann sbergman at redhat.com
Fri Dec 9 05:39:52 PST 2011


On 12/08/2011 09:45 PM, Cédric Bosdonnat wrote:
> @@ -102,7 +102,7 @@ sal_Bool RtfFilter::filter( const uno::Sequence<  beans::PropertyValue>&  aDescri
>       catch (const uno::Exception&  e)
>       {
>   #if OSL_DEBUG_LEVEL>  1
> -        OSL_TRACE( "Exception caught: %s",
> +        SAL_INFO("writerfilter", "Exception caught: "<<
>                   rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
>   #endif
>           (void)e;

For one, the "#if OSL_DEBUG_LEVEL> 1" condition can be removed (SAL_INFO 
handles that well enough internally, in combination with the SAL_LOG 
environment variable), together with the "(void)e;" -- the arguments to 
SAL_INFO are visible to the compiler regardless of OSL_DEBUG_LEVEL and 
DBG_UTIL settings, so it never considers e unused.

For another, #include "rtl/oustringostreaminserter.hxx" overloads 
std::ostream's << for rtl::OUString, so the catch block can be 
simplified to just

   {
      SAL_INFO("writerfilter", "Exception caught: " << e.Message);
   }

Stephan


More information about the LibreOffice mailing list