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
95 std::shared_ptr
< EventLogger_Impl
> m_pImpl
;
98 /** creates an <code>EventLogger</code> instance working with a css.logging.XLogger
99 instance given by ASCII name.
102 the component context to create services
105 the ASCII name of the logger to create.
108 const css::uno::Reference
< css::uno::XComponentContext
>& _rxContext
,
109 const char* _pAsciiLoggerName
113 /// determines whether an event with the given level would be logged
114 bool isLoggable( const sal_Int32 _nLogLevel
) const;
117 //- XLogger::log equivalents/wrappers
120 /// logs a given message, without any arguments, or source class/method names
121 void log( const sal_Int32 _nLogLevel
, const OUString
& rMessage
) const
123 if ( isLoggable( _nLogLevel
) )
124 impl_log(_nLogLevel
, nullptr, nullptr, rMessage
);
127 const css::uno::Reference
<css::logging::XLogger
> & getLogger() const;
129 /** logs a given message, replacing a placeholder in the message with an argument
131 The function takes, additionally to the log level and the message, an arbitrary
132 argument. This argument is converted to a string using an overloaded function
133 named <code>convertLogArgToString</code>. Then, a placeholder "$1$"
134 is searched in the message string, and replaced with the argument string.
136 template< typename ARGTYPE1
>
137 void log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
) const
139 if ( isLoggable( _nLogLevel
) )
140 impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
141 OptionalString( log::convert::convertLogArgToString( _argument1
) ) );
144 /// logs a given message, replacing 2 placeholders in the message with respective values
145 template< typename ARGTYPE1
, typename ARGTYPE2
>
146 void log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
148 if ( isLoggable( _nLogLevel
) )
149 impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
150 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
151 OptionalString( log::convert::convertLogArgToString( _argument2
) ) );
154 /// logs a given message, replacing 3 placeholders in the message with respective values
155 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
156 void log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
) const
158 if ( isLoggable( _nLogLevel
) )
159 impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
160 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
161 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
162 OptionalString( log::convert::convertLogArgToString( _argument3
) ) );
165 /// logs a given message, replacing 4 placeholders in the message with respective values
166 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
167 void log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
) const
169 if ( isLoggable( _nLogLevel
) )
170 impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
171 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
172 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
173 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
174 OptionalString( log::convert::convertLogArgToString( _argument4
) ) );
177 /// logs a given message, replacing 5 placeholders in the message with respective values
178 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
179 void log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
) const
181 if ( isLoggable( _nLogLevel
) )
182 impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
183 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
184 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
185 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
186 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
187 OptionalString( log::convert::convertLogArgToString( _argument5
) ) );
190 /// logs a given message, replacing 6 placeholders in the message with respective values
191 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
, typename ARGTYPE6
>
192 void log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
, ARGTYPE6 _argument6
) const
194 if ( isLoggable( _nLogLevel
) )
195 impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
196 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
197 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
198 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
199 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
200 OptionalString( log::convert::convertLogArgToString( _argument5
) ),
201 OptionalString( log::convert::convertLogArgToString( _argument6
) ) );
205 //- XLogger::log equivalents/wrappers
208 /** logs a given message, replacing a placeholder in the message with an argument
210 The function takes, additionally to the log level and the message, an arbitrary
211 argument. This argument is converted to a string using an overloaded function
212 named <code>convertLogArgToString</code>. Then, a placeholder "$1$"
213 is searched in the message string, and replaced with the argument string.
215 template< typename ARGTYPE1
>
216 void log( const sal_Int32 _nLogLevel
, const char* _pMessage
, ARGTYPE1 _argument1
) const
218 if ( isLoggable( _nLogLevel
) )
219 impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
220 OptionalString( log::convert::convertLogArgToString( _argument1
) ) );
223 /// logs a given message, replacing 2 placeholders in the message with respective values
224 template< typename ARGTYPE1
, typename ARGTYPE2
>
225 void log( const sal_Int32 _nLogLevel
, const char* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
227 if ( isLoggable( _nLogLevel
) )
228 impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
229 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
230 OptionalString( log::convert::convertLogArgToString( _argument2
) ) );
233 /// logs a given message, replacing 3 placeholders in the message with respective values
234 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
235 void log( const sal_Int32 _nLogLevel
, const char* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
) const
237 if ( isLoggable( _nLogLevel
) )
238 impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
239 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
240 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
241 OptionalString( log::convert::convertLogArgToString( _argument3
) ) );
244 /// logs a given message, replacing 4 placeholders in the message with respective values
245 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
246 void log( const sal_Int32 _nLogLevel
, const char* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
) const
248 if ( isLoggable( _nLogLevel
) )
249 impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
250 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
251 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
252 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
253 OptionalString( log::convert::convertLogArgToString( _argument4
) ) );
256 /// logs a given message, replacing 5 placeholders in the message with respective values
257 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
258 void log( const sal_Int32 _nLogLevel
, const char* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
) const
260 if ( isLoggable( _nLogLevel
) )
261 impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
262 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
263 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
264 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
265 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
266 OptionalString( log::convert::convertLogArgToString( _argument5
) ) );
269 /// logs a given message, replacing 6 placeholders in the message with respective values
270 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
, typename ARGTYPE6
>
271 void log( const sal_Int32 _nLogLevel
, const char* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
, ARGTYPE6 _argument6
) const
273 if ( isLoggable( _nLogLevel
) )
274 impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
275 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
276 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
277 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
278 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
279 OptionalString( log::convert::convertLogArgToString( _argument5
) ),
280 OptionalString( log::convert::convertLogArgToString( _argument6
) ) );
284 //- XLogger::logp equivalents/wrappers
287 /** logs a given message, replacing a placeholder in the message with an argument
289 The function takes, additionally to the logp level and the message, an arbitrary
290 argument. This argument is converted to a string using an overloaded function
291 named <code>convertLogArgToString</code>. Then, a placeholder "$1$"
292 is searched in the message string, and replaced with the argument string.
294 template< typename ARGTYPE1
>
295 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
) const
297 if ( isLoggable( _nLogLevel
) )
298 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
299 OptionalString( log::convert::convertLogArgToString( _argument1
) ) );
302 /// logs a given message, replacing 2 placeholders in the message with respective values
303 template< typename ARGTYPE1
, typename ARGTYPE2
>
304 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
306 if ( isLoggable( _nLogLevel
) )
307 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
308 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
309 OptionalString( log::convert::convertLogArgToString( _argument2
) ) );
312 /// logs a given message, replacing 3 placeholders in the message with respective values
313 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
314 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
) const
316 if ( isLoggable( _nLogLevel
) )
317 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
318 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
319 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
320 OptionalString( log::convert::convertLogArgToString( _argument3
) ) );
323 /// logs a given message, replacing 4 placeholders in the message with respective values
324 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
325 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
) const
327 if ( isLoggable( _nLogLevel
) )
328 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
329 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
330 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
331 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
332 OptionalString( log::convert::convertLogArgToString( _argument4
) ) );
335 /// logs a given message, replacing 5 placeholders in the message with respective values
336 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
337 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
339 if ( isLoggable( _nLogLevel
) )
340 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
341 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
342 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
343 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
344 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
345 OptionalString( log::convert::convertLogArgToString( _argument5
) ) );
348 /// logs a given message, replacing 6 placeholders in the message with respective values
349 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
, typename ARGTYPE6
>
350 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
352 if ( isLoggable( _nLogLevel
) )
353 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
354 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
355 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
356 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
357 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
358 OptionalString( log::convert::convertLogArgToString( _argument5
) ),
359 OptionalString( log::convert::convertLogArgToString( _argument6
) ) );
363 //- XLogger::logp equivalents/wrappers
366 /** logs a given ASCII message, replacing a placeholder in the message with an argument
368 The function takes, additionally to the logp level and the message, an arbitrary
369 argument. This argument is converted to a string using an overloaded function
370 named <code>convertLogArgToString</code>. Then, a placeholder "$1$"
371 is searched in the message string, and replaced with the argument string.
373 template< typename ARGTYPE1
>
374 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const char* _pAsciiMessage
, ARGTYPE1 _argument1
) const
376 if ( isLoggable( _nLogLevel
) )
377 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
378 OptionalString( log::convert::convertLogArgToString( _argument1
) ) );
381 /// logs a given ASCII message, replacing 2 placeholders in the message with respective values
382 template< typename ARGTYPE1
, typename ARGTYPE2
>
383 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const char* _pAsciiMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
385 if ( isLoggable( _nLogLevel
) )
386 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
387 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
388 OptionalString( log::convert::convertLogArgToString( _argument2
) ) );
391 /// logs a given ASCII message, replacing 3 placeholders in the message with respective values
392 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
393 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const char* _pAsciiMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
) const
395 if ( isLoggable( _nLogLevel
) )
396 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
397 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
398 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
399 OptionalString( log::convert::convertLogArgToString( _argument3
) ) );
402 /// logs a given ASCII message, replacing 4 placeholders in the message with respective values
403 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
404 void logp( const sal_Int32 _nLogLevel
, const char* _pSourceClass
, const char* _pSourceMethod
, const char* _pAsciiMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
) const
406 if ( isLoggable( _nLogLevel
) )
407 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
408 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
409 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
410 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
411 OptionalString( log::convert::convertLogArgToString( _argument4
) ) );
414 /// logs a given ASCII message, replacing 5 placeholders in the message with respective values
415 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
416 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
418 if ( isLoggable( _nLogLevel
) )
419 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
420 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
421 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
422 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
423 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
424 OptionalString( log::convert::convertLogArgToString( _argument5
) ) );
427 /// logs a given ASCII message, replacing 6 placeholders in the message with respective values
428 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
, typename ARGTYPE6
>
429 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
431 if ( isLoggable( _nLogLevel
) )
432 impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
433 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
434 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
435 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
436 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
437 OptionalString( log::convert::convertLogArgToString( _argument5
) ),
438 OptionalString( log::convert::convertLogArgToString( _argument6
) ) );
443 const sal_Int32 _nLogLevel
,
444 const char* _pSourceClass
,
445 const char* _pSourceMethod
,
446 const OUString
& _rMessage
,
447 const OptionalString
& _rArgument1
= OptionalString(),
448 const OptionalString
& _rArgument2
= OptionalString(),
449 const OptionalString
& _rArgument3
= OptionalString(),
450 const OptionalString
& _rArgument4
= OptionalString(),
451 const OptionalString
& _rArgument5
= OptionalString(),
452 const OptionalString
& _rArgument6
= OptionalString()
455 } // namespace comphelper
458 #endif // INCLUDED_COMPHELPER_LOGGING_HXX
460 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */