1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_COMPHELPER_LOGGING_HXX
21 #define INCLUDED_COMPHELPER_LOGGING_HXX
23 #include <comphelper/comphelperdllapi.h>
24 #include <rtl/ustring.hxx>
29 namespace com::sun::star::uno
{ template <class interface_type
> class Reference
; }
30 namespace com::sun::star::uno
{ class XComponentContext
; }
31 namespace com::sun::star::logging
{ class XLogger
; }
37 //= string conversions, employed by the templatized log* members of
41 namespace log::convert
43 inline const OUString
& convertLogArgToString( const OUString
& _rValue
)
48 inline OUString
convertLogArgToString( const char* _pAsciiValue
)
50 return OUString::createFromAscii( _pAsciiValue
);
53 inline OUString
convertLogArgToString( double _nValue
) { return OUString::number( _nValue
); }
54 inline OUString
convertLogArgToString( float _nValue
) { return OUString::number( _nValue
); }
55 inline OUString
convertLogArgToString( sal_Int64 _nValue
) { return OUString::number( _nValue
); }
56 inline OUString
convertLogArgToString( sal_Int32 _nValue
) { return OUString::number( _nValue
); }
57 inline OUString
convertLogArgToString( sal_Int16 _nValue
) { return OUString::number( _nValue
); }
58 inline OUString
convertLogArgToString( sal_Unicode _nValue
) { return OUString( _nValue
); }
59 inline OUString
convertLogArgToString( bool _bValue
) { return OUString::boolean( _bValue
); }
60 void convertLogArgToString(sal_Bool
) = delete;
62 } // namespace log::convert
67 class EventLogger_Impl
;
68 typedef ::std::optional
< OUString
> OptionalString
;
70 /** encapsulates a css::logging::XLogger
72 The class silences several (unlikely) errors which could potentially happen
73 when working with a logger. Additionally, it provides some convenience methods
76 You can use this class as follows
78 EventLogger aLogger( xContext, sLoggerName );
80 aLogger.log( LogLevel::SEVERE, sSomeMessage );
81 aLogger.logp( LogLevel::CONFIG, "MyClass", "MyMethod", sSomeMessage, SomeParameter1, SomeParameter2, SomeParameter3 );
84 The <code>log</code> and <code>logp</code> calls support up to 6 parameters, which can be of
85 arbitrary type. For every parameter, there must exist a function <code>convertLogArgToString</code>
86 which takes an argument of the respective type, and returns a string.
88 After a parameter has been converted to a string using the above mentioned
89 <code>convertLogArgToString</code> function, a placeholder $1$ (resp. $2$ resp. $4$ ...)
90 in the message will be replaced with this string, and the resulting message will be logged.
92 class COMPHELPER_DLLPUBLIC EventLogger
94 std::shared_ptr
< EventLogger_Impl
> m_pImpl
;
97 /** creates an <code>EventLogger</code> instance working with a css.logging.XLogger
98 instance given by ASCII name.
101 the component context to create services
104 the ASCII name of the logger to create.
107 const css::uno::Reference
< css::uno::XComponentContext
>& _rxContext
,
108 const char* _pAsciiLoggerName
112 /// determines whether an event with the given level would be logged
113 bool isLoggable( const sal_Int32 _nLogLevel
) const;
116 //- XLogger::log equivalents/wrappers
119 /// logs a given message, without any arguments, or source class/method names
120 void log( const sal_Int32 _nLogLevel
, const OUString
& rMessage
) const
122 if ( isLoggable( _nLogLevel
) )
123 impl_log(_nLogLevel
, nullptr, nullptr, rMessage
);
126 const css::uno::Reference
<css::logging::XLogger
> & getLogger() const;
128 /** logs a given message, replacing a placeholder in the message with an argument
130 The function takes, additionally to the log level and the message, an arbitrary
131 argument. This argument is converted to a string using an overloaded function
132 named <code>convertLogArgToString</code>. Then, a placeholder "$1$"
133 is searched in the message string, and replaced with the argument string.
135 template< typename ARGTYPE1
>
136 void log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
) const
138 if ( isLoggable( _nLogLevel
) )
139 impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
140 OptionalString( log::convert::convertLogArgToString( _argument1
) ) );
143 /// logs a given message, replacing 2 placeholders in the message with respective values
144 template< typename ARGTYPE1
, typename ARGTYPE2
>
145 void log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
147 if ( isLoggable( _nLogLevel
) )
148 impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
149 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
150 OptionalString( log::convert::convertLogArgToString( _argument2
) ) );
153 /// logs a given message, replacing 3 placeholders in the message with respective values
154 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
155 void log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
) const
157 if ( isLoggable( _nLogLevel
) )
158 impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
159 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
160 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
161 OptionalString( log::convert::convertLogArgToString( _argument3
) ) );
164 /// logs a given message, replacing 4 placeholders in the message with respective values
165 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
166 void log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
) const
168 if ( isLoggable( _nLogLevel
) )
169 impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
170 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
171 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
172 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
173 OptionalString( log::convert::convertLogArgToString( _argument4
) ) );
176 /// logs a given message, replacing 5 placeholders in the message with respective values
177 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
178 void log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
) const
180 if ( isLoggable( _nLogLevel
) )
181 impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
182 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
183 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
184 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
185 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
186 OptionalString( log::convert::convertLogArgToString( _argument5
) ) );
189 /// logs a given message, replacing 6 placeholders in the message with respective values
190 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
, typename ARGTYPE6
>
191 void log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
, ARGTYPE6 _argument6
) const
193 if ( isLoggable( _nLogLevel
) )
194 impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
195 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
196 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
197 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
198 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
199 OptionalString( log::convert::convertLogArgToString( _argument5
) ),
200 OptionalString( log::convert::convertLogArgToString( _argument6
) ) );
204 //- XLogger::log equivalents/wrappers
207 /** logs a given message, replacing a placeholder in the message with an argument
209 The function takes, additionally to the log level and the message, an arbitrary
210 argument. This argument is converted to a string using an overloaded function
211 named <code>convertLogArgToString</code>. Then, a placeholder "$1$"
212 is searched in the message string, and replaced with the argument string.
214 template< typename ARGTYPE1
>
215 void log( const sal_Int32 _nLogLevel
, const char* _pMessage
, ARGTYPE1 _argument1
) const
217 if ( isLoggable( _nLogLevel
) )
218 impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
219 OptionalString( log::convert::convertLogArgToString( _argument1
) ) );
222 /// logs a given message, replacing 2 placeholders in the message with respective values
223 template< typename ARGTYPE1
, typename ARGTYPE2
>
224 void log( const sal_Int32 _nLogLevel
, const char* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
226 if ( isLoggable( _nLogLevel
) )
227 impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
228 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
229 OptionalString( log::convert::convertLogArgToString( _argument2
) ) );
232 /// logs a given message, replacing 3 placeholders in the message with respective values
233 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
234 void log( const sal_Int32 _nLogLevel
, const char* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
) const
236 if ( isLoggable( _nLogLevel
) )
237 impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
238 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
239 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
240 OptionalString( log::convert::convertLogArgToString( _argument3
) ) );
243 /// logs a given message, replacing 4 placeholders in the message with respective values
244 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
245 void log( const sal_Int32 _nLogLevel
, const char* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
) const
247 if ( isLoggable( _nLogLevel
) )
248 impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
249 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
250 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
251 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
252 OptionalString( log::convert::convertLogArgToString( _argument4
) ) );
255 /// logs a given message, replacing 5 placeholders in the message with respective values
256 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
257 void log( const sal_Int32 _nLogLevel
, const char* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
) const
259 if ( isLoggable( _nLogLevel
) )
260 impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
261 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
262 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
263 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
264 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
265 OptionalString( log::convert::convertLogArgToString( _argument5
) ) );
268 /// logs a given message, replacing 6 placeholders in the message with respective values
269 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
, typename ARGTYPE6
>
270 void log( const sal_Int32 _nLogLevel
, const char* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
, ARGTYPE6 _argument6
) const
272 if ( isLoggable( _nLogLevel
) )
273 impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
274 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
275 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
276 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
277 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
278 OptionalString( log::convert::convertLogArgToString( _argument5
) ),
279 OptionalString( log::convert::convertLogArgToString( _argument6
) ) );
283 //- XLogger::logp equivalents/wrappers
286 /** logs a given message, replacing a placeholder in the message with an argument
288 The function takes, additionally to the logp level and the message, an arbitrary
289 argument. This argument is converted to a string using an overloaded function
290 named <code>convertLogArgToString</code>. Then, a placeholder "$1$"
291 is searched in the message string, and replaced with the argument string.
293 template< typename ARGTYPE1
>
294 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
) const
296 if ( isLoggable( _nLogLevel
) )
297 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
298 OptionalString( log::convert::convertLogArgToString( _argument1
) ) );
301 /// logs a given message, replacing 2 placeholders in the message with respective values
302 template< typename ARGTYPE1
, typename ARGTYPE2
>
303 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
305 if ( isLoggable( _nLogLevel
) )
306 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
307 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
308 OptionalString( log::convert::convertLogArgToString( _argument2
) ) );
311 /// logs a given message, replacing 3 placeholders in the message with respective values
312 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
313 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
) const
315 if ( isLoggable( _nLogLevel
) )
316 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
317 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
318 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
319 OptionalString( log::convert::convertLogArgToString( _argument3
) ) );
322 /// logs a given message, replacing 4 placeholders in the message with respective values
323 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
324 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
) const
326 if ( isLoggable( _nLogLevel
) )
327 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
328 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
329 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
330 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
331 OptionalString( log::convert::convertLogArgToString( _argument4
) ) );
334 /// logs a given message, replacing 5 placeholders in the message with respective values
335 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
336 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
) const
338 if ( isLoggable( _nLogLevel
) )
339 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
340 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
341 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
342 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
343 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
344 OptionalString( log::convert::convertLogArgToString( _argument5
) ) );
347 /// logs a given message, replacing 6 placeholders in the message with respective values
348 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
, typename ARGTYPE6
>
349 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
, ARGTYPE6 _argument6
) const
351 if ( isLoggable( _nLogLevel
) )
352 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
353 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
354 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
355 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
356 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
357 OptionalString( log::convert::convertLogArgToString( _argument5
) ),
358 OptionalString( log::convert::convertLogArgToString( _argument6
) ) );
362 //- XLogger::logp equivalents/wrappers
365 /** logs a given ASCII message, replacing a placeholder in the message with an argument
367 The function takes, additionally to the logp level and the message, an arbitrary
368 argument. This argument is converted to a string using an overloaded function
369 named <code>convertLogArgToString</code>. Then, a placeholder "$1$"
370 is searched in the message string, and replaced with the argument string.
372 template< typename ARGTYPE1
>
373 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const char* _pAsciiMessage
, ARGTYPE1 _argument1
) const
375 if ( isLoggable( _nLogLevel
) )
376 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
377 OptionalString( log::convert::convertLogArgToString( _argument1
) ) );
380 /// logs a given ASCII message, replacing 2 placeholders in the message with respective values
381 template< typename ARGTYPE1
, typename ARGTYPE2
>
382 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const char* _pAsciiMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
384 if ( isLoggable( _nLogLevel
) )
385 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
386 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
387 OptionalString( log::convert::convertLogArgToString( _argument2
) ) );
390 /// logs a given ASCII message, replacing 3 placeholders in the message with respective values
391 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
392 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const char* _pAsciiMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
) const
394 if ( isLoggable( _nLogLevel
) )
395 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
396 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
397 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
398 OptionalString( log::convert::convertLogArgToString( _argument3
) ) );
401 /// logs a given ASCII message, replacing 4 placeholders in the message with respective values
402 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
403 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const char* _pAsciiMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
) const
405 if ( isLoggable( _nLogLevel
) )
406 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
407 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
408 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
409 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
410 OptionalString( log::convert::convertLogArgToString( _argument4
) ) );
413 /// logs a given ASCII message, replacing 5 placeholders in the message with respective values
414 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
415 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const char* _pAsciiMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
) const
417 if ( isLoggable( _nLogLevel
) )
418 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
419 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
420 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
421 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
422 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
423 OptionalString( log::convert::convertLogArgToString( _argument5
) ) );
426 /// logs a given ASCII message, replacing 6 placeholders in the message with respective values
427 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
, typename ARGTYPE6
>
428 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const char* _pAsciiMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
, ARGTYPE6 _argument6
) const
430 if ( isLoggable( _nLogLevel
) )
431 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
432 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
433 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
434 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
435 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
436 OptionalString( log::convert::convertLogArgToString( _argument5
) ),
437 OptionalString( log::convert::convertLogArgToString( _argument6
) ) );
442 const sal_Int32 _nLogLevel
,
443 const char* _pSourceClass
,
444 const char* _pSourceMethod
,
445 const OUString
& _rMessage
,
446 const OptionalString
& _rArgument1
= OptionalString(),
447 const OptionalString
& _rArgument2
= OptionalString(),
448 const OptionalString
& _rArgument3
= OptionalString(),
449 const OptionalString
& _rArgument4
= OptionalString(),
450 const OptionalString
& _rArgument5
= OptionalString(),
451 const OptionalString
& _rArgument6
= OptionalString()
454 } // namespace comphelper
457 #endif // INCLUDED_COMPHELPER_LOGGING_HXX
459 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */