1*9877b273SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*9877b273SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*9877b273SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*9877b273SAndrew Rist * distributed with this work for additional information 6*9877b273SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*9877b273SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*9877b273SAndrew Rist * "License"); you may not use this file except in compliance 9*9877b273SAndrew Rist * with the License. You may obtain a copy of the License at 10*9877b273SAndrew Rist * 11*9877b273SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*9877b273SAndrew Rist * 13*9877b273SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*9877b273SAndrew Rist * software distributed under the License is distributed on an 15*9877b273SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*9877b273SAndrew Rist * KIND, either express or implied. See the License for the 17*9877b273SAndrew Rist * specific language governing permissions and limitations 18*9877b273SAndrew Rist * under the License. 19*9877b273SAndrew Rist * 20*9877b273SAndrew Rist *************************************************************/ 21*9877b273SAndrew Rist 22*9877b273SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef COMPHELPER_LOGGING_HXX 25cdf0e10cSrcweir #define COMPHELPER_LOGGING_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <comphelper/comphelperdllapi.h> 28cdf0e10cSrcweir 29cdf0e10cSrcweir /** === begin UNO includes === **/ 30cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 31cdf0e10cSrcweir #include <com/sun/star/logging/XLogHandler.hpp> 32cdf0e10cSrcweir #include <com/sun/star/logging/LogLevel.hpp> 33cdf0e10cSrcweir /** === end UNO includes === **/ 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 36cdf0e10cSrcweir #include <boost/optional.hpp> 37cdf0e10cSrcweir 38cdf0e10cSrcweir //........................................................................ 39cdf0e10cSrcweir namespace comphelper 40cdf0e10cSrcweir { 41cdf0e10cSrcweir //........................................................................ 42cdf0e10cSrcweir 43cdf0e10cSrcweir //==================================================================== 44cdf0e10cSrcweir //= string conversions, employed by the templatized log* members of 45cdf0e10cSrcweir //= EventLogger 46cdf0e10cSrcweir //==================================================================== 47cdf0e10cSrcweir 48cdf0e10cSrcweir namespace log { namespace convert 49cdf0e10cSrcweir { convertLogArgToString(const::rtl::OUString & _rValue)50cdf0e10cSrcweir inline const ::rtl::OUString& convertLogArgToString( const ::rtl::OUString& _rValue ) 51cdf0e10cSrcweir { 52cdf0e10cSrcweir return _rValue; 53cdf0e10cSrcweir } 54cdf0e10cSrcweir convertLogArgToString(const sal_Char * _pAsciiValue)55cdf0e10cSrcweir inline ::rtl::OUString convertLogArgToString( const sal_Char* _pAsciiValue ) 56cdf0e10cSrcweir { 57cdf0e10cSrcweir return ::rtl::OUString::createFromAscii( _pAsciiValue ); 58cdf0e10cSrcweir } 59cdf0e10cSrcweir convertLogArgToString(double _nValue)60cdf0e10cSrcweir inline ::rtl::OUString convertLogArgToString( double _nValue ) { return ::rtl::OUString::valueOf( _nValue ); } convertLogArgToString(float _nValue)61cdf0e10cSrcweir inline ::rtl::OUString convertLogArgToString( float _nValue ) { return ::rtl::OUString::valueOf( _nValue ); } convertLogArgToString(sal_Int64 _nValue)62cdf0e10cSrcweir inline ::rtl::OUString convertLogArgToString( sal_Int64 _nValue ) { return ::rtl::OUString::valueOf( _nValue ); } convertLogArgToString(sal_Int32 _nValue)63cdf0e10cSrcweir inline ::rtl::OUString convertLogArgToString( sal_Int32 _nValue ) { return ::rtl::OUString::valueOf( _nValue ); } convertLogArgToString(sal_Int16 _nValue)64cdf0e10cSrcweir inline ::rtl::OUString convertLogArgToString( sal_Int16 _nValue ) { return ::rtl::OUString::valueOf( (sal_Int32)_nValue ); } convertLogArgToString(sal_Unicode _nValue)65cdf0e10cSrcweir inline ::rtl::OUString convertLogArgToString( sal_Unicode _nValue ) { return ::rtl::OUString::valueOf( _nValue ); } convertLogArgToString(sal_Bool _nValue)66cdf0e10cSrcweir inline ::rtl::OUString convertLogArgToString( sal_Bool _nValue ) { return ::rtl::OUString::valueOf( _nValue ); } 67cdf0e10cSrcweir 68cdf0e10cSrcweir } } // namespace log::convert 69cdf0e10cSrcweir 70cdf0e10cSrcweir //==================================================================== 71cdf0e10cSrcweir //= EventLogger 72cdf0e10cSrcweir //==================================================================== 73cdf0e10cSrcweir class EventLogger_Impl; 74cdf0e10cSrcweir typedef ::boost::optional< ::rtl::OUString > OptionalString; 75cdf0e10cSrcweir 76cdf0e10cSrcweir /** encapsulates an <type scope="com::sun::star::logging">XLogger</type> 77cdf0e10cSrcweir 78cdf0e10cSrcweir The class silences several (unlikely) errors which could potentially happen 79cdf0e10cSrcweir when working with a logger. Additionally, it provides some convenience methods 80cdf0e10cSrcweir for logging events. 81cdf0e10cSrcweir 82cdf0e10cSrcweir You can use this class as follows 83cdf0e10cSrcweir <pre> 84cdf0e10cSrcweir EventLogger aLogger( xContext, sLoggerName ); 85cdf0e10cSrcweir .... 86cdf0e10cSrcweir aLogger.log( LogLevel::SEVERE, sSomeMessage ); 87cdf0e10cSrcweir aLogger.logp( LogLevel::CONFIG, "MyClass", "MyMethod", sSomeMessage, SomeParameter1, SomeParameter2, SomeParameter3 ); 88cdf0e10cSrcweir </pre> 89cdf0e10cSrcweir 90cdf0e10cSrcweir The <code>log</code> and <code>logp</code> calls support up to 6 parameters, which can be of 91cdf0e10cSrcweir arbitrary type. For every parameter, there must exist a function <code>convertLogArgToString</code> 92cdf0e10cSrcweir which takes an argument of the respective type, and returns a string. 93cdf0e10cSrcweir 94cdf0e10cSrcweir After a parameter has been converted to a string using the above mentioned 95cdf0e10cSrcweir <code>convertLogArgToString</code> function, a placeholder $1$ (resp. $2$ resp. $4$ ...) 96cdf0e10cSrcweir in the message will be replaced with this string, and the resulting message will be logged. 97cdf0e10cSrcweir */ 98cdf0e10cSrcweir class COMPHELPER_DLLPUBLIC EventLogger 99cdf0e10cSrcweir { 100cdf0e10cSrcweir protected: 101cdf0e10cSrcweir ::boost::shared_ptr< EventLogger_Impl > m_pImpl; 102cdf0e10cSrcweir 103cdf0e10cSrcweir public: 104cdf0e10cSrcweir /** creates an <code>EventLogger</code> instance working with a css.logging.XLogger 105cdf0e10cSrcweir instance given by name. 106cdf0e10cSrcweir 107cdf0e10cSrcweir @param _rxContext 108cdf0e10cSrcweir the component context to create services 109cdf0e10cSrcweir @param _rLoggerName 110cdf0e10cSrcweir the name of the logger to create. If empty, the office-wide default logger will be used. 111cdf0e10cSrcweir */ 112cdf0e10cSrcweir EventLogger( 113cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, 114cdf0e10cSrcweir const ::rtl::OUString& _rLoggerName = ::rtl::OUString() 115cdf0e10cSrcweir ); 116cdf0e10cSrcweir 117cdf0e10cSrcweir /** creates an <code>EventLogger</code> instance working with a css.logging.XLogger 118cdf0e10cSrcweir instance given by ASCII name. 119cdf0e10cSrcweir 120cdf0e10cSrcweir @param _rxContext 121cdf0e10cSrcweir the component context to create services 122cdf0e10cSrcweir 123cdf0e10cSrcweir @param _rLoggerName 124cdf0e10cSrcweir the ASCII name of the logger to create. 125cdf0e10cSrcweir */ 126cdf0e10cSrcweir EventLogger( 127cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, 128cdf0e10cSrcweir const sal_Char* _pAsciiLoggerName 129cdf0e10cSrcweir ); 130cdf0e10cSrcweir 131cdf0e10cSrcweir ~EventLogger(); 132cdf0e10cSrcweir 133cdf0e10cSrcweir public: 134cdf0e10cSrcweir /** returns the name of the logger 135cdf0e10cSrcweir */ 136cdf0e10cSrcweir const ::rtl::OUString& getName() const; 137cdf0e10cSrcweir 138cdf0e10cSrcweir /// returns the current log level threshold of the logger 139cdf0e10cSrcweir sal_Int32 getLogLevel() const; 140cdf0e10cSrcweir 141cdf0e10cSrcweir /// sets a new log level threshold of the logger 142cdf0e10cSrcweir void setLogLevel( const sal_Int32 _nLogLevel ) const; 143cdf0e10cSrcweir 144cdf0e10cSrcweir /// determines whether an event with the given level would be logged 145cdf0e10cSrcweir bool isLoggable( const sal_Int32 _nLogLevel ) const; 146cdf0e10cSrcweir 147cdf0e10cSrcweir /** adds the given log handler to the logger's set of handlers. 148cdf0e10cSrcweir 149cdf0e10cSrcweir Note that normally, you would not use this method: The logger implementations 150cdf0e10cSrcweir initialize themselves from the configuration, where usually, a default log handler 151cdf0e10cSrcweir is specified. In this case, the logger will create and use this handler. 152cdf0e10cSrcweir 153cdf0e10cSrcweir @return 154cdf0e10cSrcweir <TRUE/> if and only if the addition was successful (as far as this can be detected 155cdf0e10cSrcweir from outside the <code>XLogger</code>'s implementation. 156cdf0e10cSrcweir */ 157cdf0e10cSrcweir bool addLogHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::logging::XLogHandler >& _rxLogHandler ); 158cdf0e10cSrcweir 159cdf0e10cSrcweir /** removes the given log handler from the logger's set of handlers. 160cdf0e10cSrcweir 161cdf0e10cSrcweir @return 162cdf0e10cSrcweir <TRUE/> if and only if the addition was successful (as far as this can be detected 163cdf0e10cSrcweir from outside the <code>XLogger</code>'s implementation. 164cdf0e10cSrcweir */ 165cdf0e10cSrcweir bool removeLogHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::logging::XLogHandler >& _rxLogHandler ); 166cdf0e10cSrcweir 167cdf0e10cSrcweir //---------------------------------------------------------------- 168cdf0e10cSrcweir //- XLogger::log equivalents/wrappers 169cdf0e10cSrcweir //- string messages 170cdf0e10cSrcweir 171cdf0e10cSrcweir /// logs a given message, without any arguments, or source class/method names log(const sal_Int32 _nLogLevel,const::rtl::OUString & _rMessage) const172cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const ::rtl::OUString& _rMessage ) const 173cdf0e10cSrcweir { 174cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 175cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, _rMessage ); 176cdf0e10cSrcweir return false; 177cdf0e10cSrcweir } 178cdf0e10cSrcweir 179cdf0e10cSrcweir /** logs a given message, replacing a placeholder in the message with an argument 180cdf0e10cSrcweir 181cdf0e10cSrcweir The function takes, additionally to the log level and the message, an arbitrary 182cdf0e10cSrcweir argument. This argument is converted to a string using an overloaded function 183cdf0e10cSrcweir named <code>convertLogArgToString</code>. Then, a placeholder "$1$" 184cdf0e10cSrcweir is searched in the message string, and replaced with the argument string. 185cdf0e10cSrcweir */ 186cdf0e10cSrcweir template< typename ARGTYPE1 > log(const sal_Int32 _nLogLevel,const::rtl::OUString & _rMessage,ARGTYPE1 _argument1) const187cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const ::rtl::OUString& _rMessage, ARGTYPE1 _argument1 ) const 188cdf0e10cSrcweir { 189cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 190cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, _rMessage, 191cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ) ); 192cdf0e10cSrcweir return false; 193cdf0e10cSrcweir } 194cdf0e10cSrcweir 195cdf0e10cSrcweir /// logs a given message, replacing 2 placeholders in the message with respective values 196cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2 > log(const sal_Int32 _nLogLevel,const::rtl::OUString & _rMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2) const197cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const ::rtl::OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const 198cdf0e10cSrcweir { 199cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 200cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, _rMessage, 201cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 202cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ) ); 203cdf0e10cSrcweir return false; 204cdf0e10cSrcweir } 205cdf0e10cSrcweir 206cdf0e10cSrcweir /// logs a given message, replacing 3 placeholders in the message with respective values 207cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 > log(const sal_Int32 _nLogLevel,const::rtl::OUString & _rMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3) const208cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const ::rtl::OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const 209cdf0e10cSrcweir { 210cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 211cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, _rMessage, 212cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 213cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 214cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ) ); 215cdf0e10cSrcweir return false; 216cdf0e10cSrcweir } 217cdf0e10cSrcweir 218cdf0e10cSrcweir /// logs a given message, replacing 4 placeholders in the message with respective values 219cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 > log(const sal_Int32 _nLogLevel,const::rtl::OUString & _rMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4) const220cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const ::rtl::OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const 221cdf0e10cSrcweir { 222cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 223cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, _rMessage, 224cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 225cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 226cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 227cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ) ); 228cdf0e10cSrcweir return false; 229cdf0e10cSrcweir } 230cdf0e10cSrcweir 231cdf0e10cSrcweir /// logs a given message, replacing 5 placeholders in the message with respective values 232cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 > log(const sal_Int32 _nLogLevel,const::rtl::OUString & _rMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4,ARGTYPE5 _argument5) const233cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const ::rtl::OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const 234cdf0e10cSrcweir { 235cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 236cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, _rMessage, 237cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 238cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 239cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 240cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ), 241cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument5 ) ) ); 242cdf0e10cSrcweir return false; 243cdf0e10cSrcweir } 244cdf0e10cSrcweir 245cdf0e10cSrcweir /// logs a given message, replacing 6 placeholders in the message with respective values 246cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 > log(const sal_Int32 _nLogLevel,const::rtl::OUString & _rMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4,ARGTYPE5 _argument5,ARGTYPE6 _argument6) const247cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const ::rtl::OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const 248cdf0e10cSrcweir { 249cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 250cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, _rMessage, 251cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 252cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 253cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 254cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ), 255cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument5 ) ), 256cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument6 ) ) ); 257cdf0e10cSrcweir return false; 258cdf0e10cSrcweir } 259cdf0e10cSrcweir 260cdf0e10cSrcweir //---------------------------------------------------------------- 261cdf0e10cSrcweir //- XLogger::log equivalents/wrappers 262cdf0e10cSrcweir //- ASCII messages 263cdf0e10cSrcweir 264cdf0e10cSrcweir /// logs a given message, without any arguments, or source class/method names log(const sal_Int32 _nLogLevel,const sal_Char * _pMessage) const265cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage ) const 266cdf0e10cSrcweir { 267cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 268cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, ::rtl::OUString::createFromAscii( _pMessage ) ); 269cdf0e10cSrcweir return false; 270cdf0e10cSrcweir } 271cdf0e10cSrcweir 272cdf0e10cSrcweir /** logs a given message, replacing a placeholder in the message with an argument 273cdf0e10cSrcweir 274cdf0e10cSrcweir The function takes, additionally to the log level and the message, an arbitrary 275cdf0e10cSrcweir argument. This argument is converted to a string using an overloaded function 276cdf0e10cSrcweir named <code>convertLogArgToString</code>. Then, a placeholder "$1$" 277cdf0e10cSrcweir is searched in the message string, and replaced with the argument string. 278cdf0e10cSrcweir */ 279cdf0e10cSrcweir template< typename ARGTYPE1 > log(const sal_Int32 _nLogLevel,const sal_Char * _pMessage,ARGTYPE1 _argument1) const280cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1 ) const 281cdf0e10cSrcweir { 282cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 283cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, ::rtl::OUString::createFromAscii( _pMessage ), 284cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ) ); 285cdf0e10cSrcweir return false; 286cdf0e10cSrcweir } 287cdf0e10cSrcweir 288cdf0e10cSrcweir /// logs a given message, replacing 2 placeholders in the message with respective values 289cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2 > log(const sal_Int32 _nLogLevel,const sal_Char * _pMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2) const290cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const 291cdf0e10cSrcweir { 292cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 293cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, ::rtl::OUString::createFromAscii( _pMessage ), 294cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 295cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ) ); 296cdf0e10cSrcweir return false; 297cdf0e10cSrcweir } 298cdf0e10cSrcweir 299cdf0e10cSrcweir /// logs a given message, replacing 3 placeholders in the message with respective values 300cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 > log(const sal_Int32 _nLogLevel,const sal_Char * _pMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3) const301cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const 302cdf0e10cSrcweir { 303cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 304cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, ::rtl::OUString::createFromAscii( _pMessage ), 305cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 306cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 307cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ) ); 308cdf0e10cSrcweir return false; 309cdf0e10cSrcweir } 310cdf0e10cSrcweir 311cdf0e10cSrcweir /// logs a given message, replacing 4 placeholders in the message with respective values 312cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 > log(const sal_Int32 _nLogLevel,const sal_Char * _pMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4) const313cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const 314cdf0e10cSrcweir { 315cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 316cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, ::rtl::OUString::createFromAscii( _pMessage ), 317cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 318cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 319cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 320cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ) ); 321cdf0e10cSrcweir return false; 322cdf0e10cSrcweir } 323cdf0e10cSrcweir 324cdf0e10cSrcweir /// logs a given message, replacing 5 placeholders in the message with respective values 325cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 > log(const sal_Int32 _nLogLevel,const sal_Char * _pMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4,ARGTYPE5 _argument5) const326cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const 327cdf0e10cSrcweir { 328cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 329cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, ::rtl::OUString::createFromAscii( _pMessage ), 330cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 331cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 332cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 333cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ), 334cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument5 ) ) ); 335cdf0e10cSrcweir return false; 336cdf0e10cSrcweir } 337cdf0e10cSrcweir 338cdf0e10cSrcweir /// logs a given message, replacing 6 placeholders in the message with respective values 339cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 > log(const sal_Int32 _nLogLevel,const sal_Char * _pMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4,ARGTYPE5 _argument5,ARGTYPE6 _argument6) const340cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const 341cdf0e10cSrcweir { 342cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 343cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, ::rtl::OUString::createFromAscii( _pMessage ), 344cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 345cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 346cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 347cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ), 348cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument5 ) ), 349cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument6 ) ) ); 350cdf0e10cSrcweir return false; 351cdf0e10cSrcweir } 352cdf0e10cSrcweir 353cdf0e10cSrcweir //---------------------------------------------------------------- 354cdf0e10cSrcweir //- XLogger::logp equivalents/wrappers 355cdf0e10cSrcweir //- string messages 356cdf0e10cSrcweir 357cdf0e10cSrcweir /// logs a given message, without any arguments, or source class/method names logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const::rtl::OUString & _rMessage) const358cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const ::rtl::OUString& _rMessage ) const 359cdf0e10cSrcweir { 360cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 361cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage ); 362cdf0e10cSrcweir return false; 363cdf0e10cSrcweir } 364cdf0e10cSrcweir 365cdf0e10cSrcweir /** logs a given message, replacing a placeholder in the message with an argument 366cdf0e10cSrcweir 367cdf0e10cSrcweir The function takes, additionally to the logp level and the message, an arbitrary 368cdf0e10cSrcweir argument. This argument is converted to a string using an overloaded function 369cdf0e10cSrcweir named <code>convertLogArgToString</code>. Then, a placeholder "$1$" 370cdf0e10cSrcweir is searched in the message string, and replaced with the argument string. 371cdf0e10cSrcweir */ 372cdf0e10cSrcweir template< typename ARGTYPE1 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const::rtl::OUString & _rMessage,ARGTYPE1 _argument1) const373cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const ::rtl::OUString& _rMessage, ARGTYPE1 _argument1 ) const 374cdf0e10cSrcweir { 375cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 376cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage, 377cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ) ); 378cdf0e10cSrcweir return false; 379cdf0e10cSrcweir } 380cdf0e10cSrcweir 381cdf0e10cSrcweir /// logs a given message, replacing 2 placeholders in the message with respective values 382cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const::rtl::OUString & _rMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2) const383cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const ::rtl::OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const 384cdf0e10cSrcweir { 385cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 386cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage, 387cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 388cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ) ); 389cdf0e10cSrcweir return false; 390cdf0e10cSrcweir } 391cdf0e10cSrcweir 392cdf0e10cSrcweir /// logs a given message, replacing 3 placeholders in the message with respective values 393cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const::rtl::OUString & _rMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3) const394cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const ::rtl::OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const 395cdf0e10cSrcweir { 396cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 397cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage, 398cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 399cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 400cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ) ); 401cdf0e10cSrcweir return false; 402cdf0e10cSrcweir } 403cdf0e10cSrcweir 404cdf0e10cSrcweir /// logs a given message, replacing 4 placeholders in the message with respective values 405cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const::rtl::OUString & _rMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4) const406cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const ::rtl::OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const 407cdf0e10cSrcweir { 408cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 409cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage, 410cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 411cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 412cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 413cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ) ); 414cdf0e10cSrcweir return false; 415cdf0e10cSrcweir } 416cdf0e10cSrcweir 417cdf0e10cSrcweir /// logs a given message, replacing 5 placeholders in the message with respective values 418cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const::rtl::OUString & _rMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4,ARGTYPE5 _argument5) const419cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const ::rtl::OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const 420cdf0e10cSrcweir { 421cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 422cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage, 423cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 424cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 425cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 426cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ), 427cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument5 ) ) ); 428cdf0e10cSrcweir return false; 429cdf0e10cSrcweir } 430cdf0e10cSrcweir 431cdf0e10cSrcweir /// logs a given message, replacing 6 placeholders in the message with respective values 432cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const::rtl::OUString & _rMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4,ARGTYPE5 _argument5,ARGTYPE6 _argument6) const433cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const ::rtl::OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const 434cdf0e10cSrcweir { 435cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 436cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage, 437cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 438cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 439cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 440cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ), 441cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument5 ) ), 442cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument6 ) ) ); 443cdf0e10cSrcweir return false; 444cdf0e10cSrcweir } 445cdf0e10cSrcweir 446cdf0e10cSrcweir //---------------------------------------------------------------- 447cdf0e10cSrcweir //- XLogger::logp equivalents/wrappers 448cdf0e10cSrcweir //- ASCII messages 449cdf0e10cSrcweir 450cdf0e10cSrcweir /// logs a given ASCII message, without any arguments, or source class/method names logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Char * _pAsciiMessage) const451cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage ) const 452cdf0e10cSrcweir { 453cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 454cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, ::rtl::OUString::createFromAscii( _pAsciiMessage ) ); 455cdf0e10cSrcweir return false; 456cdf0e10cSrcweir } 457cdf0e10cSrcweir 458cdf0e10cSrcweir /** logs a given ASCII message, replacing a placeholder in the message with an argument 459cdf0e10cSrcweir 460cdf0e10cSrcweir The function takes, additionally to the logp level and the message, an arbitrary 461cdf0e10cSrcweir argument. This argument is converted to a string using an overloaded function 462cdf0e10cSrcweir named <code>convertLogArgToString</code>. Then, a placeholder "$1$" 463cdf0e10cSrcweir is searched in the message string, and replaced with the argument string. 464cdf0e10cSrcweir */ 465cdf0e10cSrcweir template< typename ARGTYPE1 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Char * _pAsciiMessage,ARGTYPE1 _argument1) const466cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1 ) const 467cdf0e10cSrcweir { 468cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 469cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, ::rtl::OUString::createFromAscii( _pAsciiMessage ), 470cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ) ); 471cdf0e10cSrcweir return false; 472cdf0e10cSrcweir } 473cdf0e10cSrcweir 474cdf0e10cSrcweir /// logs a given ASCII message, replacing 2 placeholders in the message with respective values 475cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Char * _pAsciiMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2) const476cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const 477cdf0e10cSrcweir { 478cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 479cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, ::rtl::OUString::createFromAscii( _pAsciiMessage ), 480cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 481cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ) ); 482cdf0e10cSrcweir return false; 483cdf0e10cSrcweir } 484cdf0e10cSrcweir 485cdf0e10cSrcweir /// logs a given ASCII message, replacing 3 placeholders in the message with respective values 486cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Char * _pAsciiMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3) const487cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const 488cdf0e10cSrcweir { 489cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 490cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, ::rtl::OUString::createFromAscii( _pAsciiMessage ), 491cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 492cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 493cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ) ); 494cdf0e10cSrcweir return false; 495cdf0e10cSrcweir } 496cdf0e10cSrcweir 497cdf0e10cSrcweir /// logs a given ASCII message, replacing 4 placeholders in the message with respective values 498cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Char * _pAsciiMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4) const499cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const 500cdf0e10cSrcweir { 501cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 502cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, ::rtl::OUString::createFromAscii( _pAsciiMessage ), 503cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 504cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 505cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 506cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ) ); 507cdf0e10cSrcweir return false; 508cdf0e10cSrcweir } 509cdf0e10cSrcweir 510cdf0e10cSrcweir /// logs a given ASCII message, replacing 5 placeholders in the message with respective values 511cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Char * _pAsciiMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4,ARGTYPE5 _argument5) const512cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const 513cdf0e10cSrcweir { 514cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 515cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, ::rtl::OUString::createFromAscii( _pAsciiMessage ), 516cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 517cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 518cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 519cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ), 520cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument5 ) ) ); 521cdf0e10cSrcweir return false; 522cdf0e10cSrcweir } 523cdf0e10cSrcweir 524cdf0e10cSrcweir /// logs a given ASCII message, replacing 6 placeholders in the message with respective values 525cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Char * _pAsciiMessage,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4,ARGTYPE5 _argument5,ARGTYPE6 _argument6) const526cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const 527cdf0e10cSrcweir { 528cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 529cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, ::rtl::OUString::createFromAscii( _pAsciiMessage ), 530cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 531cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 532cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 533cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ), 534cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument5 ) ), 535cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument6 ) ) ); 536cdf0e10cSrcweir return false; 537cdf0e10cSrcweir } 538cdf0e10cSrcweir 539cdf0e10cSrcweir protected: 540cdf0e10cSrcweir bool impl_log( 541cdf0e10cSrcweir const sal_Int32 _nLogLevel, 542cdf0e10cSrcweir const sal_Char* _pSourceClass, 543cdf0e10cSrcweir const sal_Char* _pSourceMethod, 544cdf0e10cSrcweir const ::rtl::OUString& _rMessage, 545cdf0e10cSrcweir const OptionalString& _rArgument1 = OptionalString(), 546cdf0e10cSrcweir const OptionalString& _rArgument2 = OptionalString(), 547cdf0e10cSrcweir const OptionalString& _rArgument3 = OptionalString(), 548cdf0e10cSrcweir const OptionalString& _rArgument4 = OptionalString(), 549cdf0e10cSrcweir const OptionalString& _rArgument5 = OptionalString(), 550cdf0e10cSrcweir const OptionalString& _rArgument6 = OptionalString() 551cdf0e10cSrcweir ) const; 552cdf0e10cSrcweir }; 553cdf0e10cSrcweir 554cdf0e10cSrcweir //==================================================================== 555cdf0e10cSrcweir //= ResourceBasedEventLogger 556cdf0e10cSrcweir //==================================================================== 557cdf0e10cSrcweir struct ResourceBasedEventLogger_Data; 558cdf0e10cSrcweir /** extends the EventLogger class with functionality to load log messages from 559cdf0e10cSrcweir a resource bundle. 560cdf0e10cSrcweir */ 561cdf0e10cSrcweir class COMPHELPER_DLLPUBLIC ResourceBasedEventLogger : public EventLogger 562cdf0e10cSrcweir { 563cdf0e10cSrcweir private: 564cdf0e10cSrcweir ::boost::shared_ptr< ResourceBasedEventLogger_Data > m_pData; 565cdf0e10cSrcweir 566cdf0e10cSrcweir public: 567cdf0e10cSrcweir /** creates a resource based event logger 568cdf0e10cSrcweir @param _rxContext 569cdf0e10cSrcweir the component context for creating new components 570cdf0e10cSrcweir @param _rResourceBundleBaseName 571cdf0e10cSrcweir the base name of the resource bundle to use. Will be used 572cdf0e10cSrcweir in conjunction with XResourceBundleLoader::loadResource. 573cdf0e10cSrcweir @param _rLoggerName 574cdf0e10cSrcweir the name of the logger to work with. If empty, the office-wide 575cdf0e10cSrcweir default logger will be used. 576cdf0e10cSrcweir 577cdf0e10cSrcweir */ 578cdf0e10cSrcweir ResourceBasedEventLogger( 579cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, 580cdf0e10cSrcweir const ::rtl::OUString& _rResourceBundleBaseName, 581cdf0e10cSrcweir const ::rtl::OUString& _rLoggerName = ::rtl::OUString() 582cdf0e10cSrcweir ); 583cdf0e10cSrcweir 584cdf0e10cSrcweir /** creates a resource based event logger 585cdf0e10cSrcweir @param _rxContext 586cdf0e10cSrcweir the component context for creating new components 587cdf0e10cSrcweir @param _pResourceBundleBaseName 588cdf0e10cSrcweir the ASCII base name of the resource bundle to use. Will be used 589cdf0e10cSrcweir in conjunction with XResourceBundleLoader::loadResource. 590cdf0e10cSrcweir @param _pAsciiLoggerName 591cdf0e10cSrcweir the ASCII name of the logger to work with. If NULL, the office-wide 592cdf0e10cSrcweir default logger will be used. 593cdf0e10cSrcweir 594cdf0e10cSrcweir */ 595cdf0e10cSrcweir ResourceBasedEventLogger( 596cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext, 597cdf0e10cSrcweir const sal_Char* _pResourceBundleBaseName, 598cdf0e10cSrcweir const sal_Char* _pAsciiLoggerName = NULL 599cdf0e10cSrcweir ); 600cdf0e10cSrcweir 601cdf0e10cSrcweir //---------------------------------------------------------------- 602cdf0e10cSrcweir //- XLogger::log equivalents/wrappers 603cdf0e10cSrcweir //- resource IDs 604cdf0e10cSrcweir 605cdf0e10cSrcweir /// logs a given message, without any arguments, or source class/method names log(const sal_Int32 _nLogLevel,const sal_Int32 _nMessageResID) const606cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID ) const 607cdf0e10cSrcweir { 608cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 609cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ) ); 610cdf0e10cSrcweir return false; 611cdf0e10cSrcweir } 612cdf0e10cSrcweir 613cdf0e10cSrcweir /** logs a given message, replacing a placeholder in the message with an argument 614cdf0e10cSrcweir 615cdf0e10cSrcweir The function takes, additionally to the log level and the message, an arbitrary 616cdf0e10cSrcweir argument. This argument is converted to a string using an overloaded function 617cdf0e10cSrcweir named <code>convertLogArgToString</code>. Then, a placeholder "$1$" 618cdf0e10cSrcweir is searched in the message string, and replaced with the argument string. 619cdf0e10cSrcweir */ 620cdf0e10cSrcweir template< typename ARGTYPE1 > log(const sal_Int32 _nLogLevel,const sal_Int32 _nMessageResID,ARGTYPE1 _argument1) const621cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1 ) const 622cdf0e10cSrcweir { 623cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 624cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ), 625cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ) ); 626cdf0e10cSrcweir return false; 627cdf0e10cSrcweir } 628cdf0e10cSrcweir 629cdf0e10cSrcweir /// logs a given message, replacing 2 placeholders in the message with respective values 630cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2 > log(const sal_Int32 _nLogLevel,const sal_Int32 _nMessageResID,ARGTYPE1 _argument1,ARGTYPE2 _argument2) const631cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const 632cdf0e10cSrcweir { 633cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 634cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ), 635cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 636cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ) ); 637cdf0e10cSrcweir return false; 638cdf0e10cSrcweir } 639cdf0e10cSrcweir 640cdf0e10cSrcweir /// logs a given message, replacing 3 placeholders in the message with respective values 641cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 > log(const sal_Int32 _nLogLevel,const sal_Int32 _nMessageResID,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3) const642cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const 643cdf0e10cSrcweir { 644cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 645cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ), 646cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 647cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 648cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ) ); 649cdf0e10cSrcweir return false; 650cdf0e10cSrcweir } 651cdf0e10cSrcweir 652cdf0e10cSrcweir /// logs a given message, replacing 4 placeholders in the message with respective values 653cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 > log(const sal_Int32 _nLogLevel,const sal_Int32 _nMessageResID,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4) const654cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const 655cdf0e10cSrcweir { 656cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 657cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ), 658cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 659cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 660cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 661cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ) ); 662cdf0e10cSrcweir return false; 663cdf0e10cSrcweir } 664cdf0e10cSrcweir 665cdf0e10cSrcweir /// logs a given message, replacing 5 placeholders in the message with respective values 666cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 > log(const sal_Int32 _nLogLevel,const sal_Int32 _nMessageResID,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4,ARGTYPE5 _argument5) const667cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const 668cdf0e10cSrcweir { 669cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 670cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ), 671cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 672cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 673cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 674cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ), 675cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument5 ) ) ); 676cdf0e10cSrcweir return false; 677cdf0e10cSrcweir } 678cdf0e10cSrcweir 679cdf0e10cSrcweir /// logs a given message, replacing 6 placeholders in the message with respective values 680cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 > log(const sal_Int32 _nLogLevel,const sal_Int32 _nMessageResID,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4,ARGTYPE5 _argument5,ARGTYPE6 _argument6) const681cdf0e10cSrcweir bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const 682cdf0e10cSrcweir { 683cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 684cdf0e10cSrcweir return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ), 685cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 686cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 687cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 688cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ), 689cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument5 ) ), 690cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument6 ) ) ); 691cdf0e10cSrcweir return false; 692cdf0e10cSrcweir } 693cdf0e10cSrcweir 694cdf0e10cSrcweir //---------------------------------------------------------------- 695cdf0e10cSrcweir //- XLogger::logp equivalents/wrappers 696cdf0e10cSrcweir //- resource IDs 697cdf0e10cSrcweir 698cdf0e10cSrcweir /// logs a given ASCII message, without any arguments, or source class/method names logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Int32 _nMessageResID) const699cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID ) const 700cdf0e10cSrcweir { 701cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 702cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ) ); 703cdf0e10cSrcweir return false; 704cdf0e10cSrcweir } 705cdf0e10cSrcweir 706cdf0e10cSrcweir /** logs a given ASCII message, replacing a placeholder in the message with an argument 707cdf0e10cSrcweir */ 708cdf0e10cSrcweir template< typename ARGTYPE1 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Int32 _nMessageResID,ARGTYPE1 _argument1) const709cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1 ) const 710cdf0e10cSrcweir { 711cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 712cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ), 713cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ) ); 714cdf0e10cSrcweir return false; 715cdf0e10cSrcweir } 716cdf0e10cSrcweir 717cdf0e10cSrcweir /// logs a given ASCII message, replacing 2 placeholders in the message with respective values 718cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Int32 _nMessageResID,ARGTYPE1 _argument1,ARGTYPE2 _argument2) const719cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const 720cdf0e10cSrcweir { 721cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 722cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ), 723cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 724cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ) ); 725cdf0e10cSrcweir return false; 726cdf0e10cSrcweir } 727cdf0e10cSrcweir 728cdf0e10cSrcweir /// logs a given ASCII message, replacing 3 placeholders in the message with respective values 729cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Int32 _nMessageResID,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3) const730cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const 731cdf0e10cSrcweir { 732cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 733cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ), 734cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 735cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 736cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ) ); 737cdf0e10cSrcweir return false; 738cdf0e10cSrcweir } 739cdf0e10cSrcweir 740cdf0e10cSrcweir /// logs a given ASCII message, replacing 4 placeholders in the message with respective values 741cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Int32 _nMessageResID,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4) const742cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const 743cdf0e10cSrcweir { 744cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 745cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ), 746cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 747cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 748cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 749cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ) ); 750cdf0e10cSrcweir return false; 751cdf0e10cSrcweir } 752cdf0e10cSrcweir 753cdf0e10cSrcweir /// logs a given ASCII message, replacing 5 placeholders in the message with respective values 754cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Int32 _nMessageResID,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4,ARGTYPE5 _argument5) const755cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const 756cdf0e10cSrcweir { 757cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 758cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ), 759cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 760cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 761cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 762cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ), 763cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument5 ) ) ); 764cdf0e10cSrcweir return false; 765cdf0e10cSrcweir } 766cdf0e10cSrcweir 767cdf0e10cSrcweir /// logs a given ASCII message, replacing 6 placeholders in the message with respective values 768cdf0e10cSrcweir template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 > logp(const sal_Int32 _nLogLevel,const sal_Char * _pSourceClass,const sal_Char * _pSourceMethod,const sal_Int32 _nMessageResID,ARGTYPE1 _argument1,ARGTYPE2 _argument2,ARGTYPE3 _argument3,ARGTYPE4 _argument4,ARGTYPE5 _argument5,ARGTYPE6 _argument6) const769cdf0e10cSrcweir bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const 770cdf0e10cSrcweir { 771cdf0e10cSrcweir if ( isLoggable( _nLogLevel ) ) 772cdf0e10cSrcweir return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ), 773cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument1 ) ), 774cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument2 ) ), 775cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument3 ) ), 776cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument4 ) ), 777cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument5 ) ), 778cdf0e10cSrcweir OptionalString( log::convert::convertLogArgToString( _argument6 ) ) ); 779cdf0e10cSrcweir return false; 780cdf0e10cSrcweir } 781cdf0e10cSrcweir 782cdf0e10cSrcweir private: 783cdf0e10cSrcweir ::rtl::OUString impl_loadStringMessage_nothrow( const sal_Int32 _nMessageResID ) const; 784cdf0e10cSrcweir }; 785cdf0e10cSrcweir 786cdf0e10cSrcweir //........................................................................ 787cdf0e10cSrcweir } // namespace comphelper 788cdf0e10cSrcweir //........................................................................ 789cdf0e10cSrcweir 790cdf0e10cSrcweir #endif // COMPHELPER_LOGGING_HXX 791