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>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <com/sun/star/logging/XLogHandler.hpp>
27 #include <com/sun/star/logging/LogLevel.hpp>
29 #include <boost/optional.hpp>
36 //= string conversions, employed by the templatized log* members of
40 namespace log
{ namespace convert
42 inline const OUString
& convertLogArgToString( const OUString
& _rValue
)
47 inline OUString
convertLogArgToString( const sal_Char
* _pAsciiValue
)
49 return OUString::createFromAscii( _pAsciiValue
);
52 inline OUString
convertLogArgToString( double _nValue
) { return OUString::number( _nValue
); }
53 inline OUString
convertLogArgToString( float _nValue
) { return OUString::number( _nValue
); }
54 inline OUString
convertLogArgToString( sal_Int64 _nValue
) { return OUString::number( _nValue
); }
55 inline OUString
convertLogArgToString( sal_Int32 _nValue
) { return OUString::number( _nValue
); }
56 inline OUString
convertLogArgToString( sal_Int16 _nValue
) { return OUString::number( _nValue
); }
57 inline OUString
convertLogArgToString( sal_Unicode _nValue
) { return OUString( _nValue
); }
58 inline OUString
convertLogArgToString( bool _bValue
) { return OUString::boolean( _bValue
); }
59 void convertLogArgToString(sal_Bool
) = delete;
61 } } // namespace log::convert
66 class EventLogger_Impl
;
67 typedef ::boost::optional
< OUString
> OptionalString
;
69 /** encapsulates an css::logging::XLogger
71 The class silences several (unlikely) errors which could potentially happen
72 when working with a logger. Additionally, it provides some convenience methods
75 You can use this class as follows
77 EventLogger aLogger( xContext, sLoggerName );
79 aLogger.log( LogLevel::SEVERE, sSomeMessage );
80 aLogger.logp( LogLevel::CONFIG, "MyClass", "MyMethod", sSomeMessage, SomeParameter1, SomeParameter2, SomeParameter3 );
83 The <code>log</code> and <code>logp</code> calls support up to 6 parameters, which can be of
84 arbitrary type. For every parameter, there must exist a function <code>convertLogArgToString</code>
85 which takes an argument of the respective type, and returns a string.
87 After a parameter has been converted to a string using the above mentioned
88 <code>convertLogArgToString</code> function, a placeholder $1$ (resp. $2$ resp. $4$ ...)
89 in the message will be replaced with this string, and the resulting message will be logged.
91 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 sal_Char
* _pAsciiLoggerName
114 /// determines whether an event with the given level would be logged
115 bool isLoggable( const sal_Int32 _nLogLevel
) const;
118 //- XLogger::log equivalents/wrappers
121 /// logs a given message, without any arguments, or source class/method names
122 bool log( const sal_Int32 _nLogLevel
, const OUString
& rMessage
) const
124 if ( isLoggable( _nLogLevel
) )
125 return impl_log(_nLogLevel
, nullptr, nullptr, rMessage
);
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 bool log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
) const
139 if ( isLoggable( _nLogLevel
) )
140 return impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
141 OptionalString( log::convert::convertLogArgToString( _argument1
) ) );
145 /// logs a given message, replacing 2 placeholders in the message with respective values
146 template< typename ARGTYPE1
, typename ARGTYPE2
>
147 bool log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
149 if ( isLoggable( _nLogLevel
) )
150 return impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
151 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
152 OptionalString( log::convert::convertLogArgToString( _argument2
) ) );
156 /// logs a given message, replacing 3 placeholders in the message with respective values
157 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
158 bool log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
) const
160 if ( isLoggable( _nLogLevel
) )
161 return impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
162 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
163 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
164 OptionalString( log::convert::convertLogArgToString( _argument3
) ) );
168 /// logs a given message, replacing 4 placeholders in the message with respective values
169 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
170 bool log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
) const
172 if ( isLoggable( _nLogLevel
) )
173 return impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
174 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
175 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
176 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
177 OptionalString( log::convert::convertLogArgToString( _argument4
) ) );
181 /// logs a given message, replacing 5 placeholders in the message with respective values
182 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
183 bool log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
) const
185 if ( isLoggable( _nLogLevel
) )
186 return impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
187 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
188 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
189 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
190 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
191 OptionalString( log::convert::convertLogArgToString( _argument5
) ) );
195 /// logs a given message, replacing 6 placeholders in the message with respective values
196 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
, typename ARGTYPE6
>
197 bool log( const sal_Int32 _nLogLevel
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
, ARGTYPE6 _argument6
) const
199 if ( isLoggable( _nLogLevel
) )
200 return impl_log( _nLogLevel
, nullptr, nullptr, _rMessage
,
201 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
202 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
203 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
204 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
205 OptionalString( log::convert::convertLogArgToString( _argument5
) ),
206 OptionalString( log::convert::convertLogArgToString( _argument6
) ) );
211 //- XLogger::log equivalents/wrappers
214 /** logs a given message, replacing a placeholder in the message with an argument
216 The function takes, additionally to the log level and the message, an arbitrary
217 argument. This argument is converted to a string using an overloaded function
218 named <code>convertLogArgToString</code>. Then, a placeholder "$1$"
219 is searched in the message string, and replaced with the argument string.
221 template< typename ARGTYPE1
>
222 bool log( const sal_Int32 _nLogLevel
, const sal_Char
* _pMessage
, ARGTYPE1 _argument1
) const
224 if ( isLoggable( _nLogLevel
) )
225 return impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
226 OptionalString( log::convert::convertLogArgToString( _argument1
) ) );
230 /// logs a given message, replacing 2 placeholders in the message with respective values
231 template< typename ARGTYPE1
, typename ARGTYPE2
>
232 bool log( const sal_Int32 _nLogLevel
, const sal_Char
* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
234 if ( isLoggable( _nLogLevel
) )
235 return impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
236 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
237 OptionalString( log::convert::convertLogArgToString( _argument2
) ) );
241 /// logs a given message, replacing 3 placeholders in the message with respective values
242 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
243 bool log( const sal_Int32 _nLogLevel
, const sal_Char
* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
) const
245 if ( isLoggable( _nLogLevel
) )
246 return impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
247 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
248 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
249 OptionalString( log::convert::convertLogArgToString( _argument3
) ) );
253 /// logs a given message, replacing 4 placeholders in the message with respective values
254 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
255 bool log( const sal_Int32 _nLogLevel
, const sal_Char
* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
) const
257 if ( isLoggable( _nLogLevel
) )
258 return impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
259 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
260 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
261 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
262 OptionalString( log::convert::convertLogArgToString( _argument4
) ) );
266 /// logs a given message, replacing 5 placeholders in the message with respective values
267 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
268 bool log( const sal_Int32 _nLogLevel
, const sal_Char
* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
) const
270 if ( isLoggable( _nLogLevel
) )
271 return impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
272 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
273 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
274 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
275 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
276 OptionalString( log::convert::convertLogArgToString( _argument5
) ) );
280 /// logs a given message, replacing 6 placeholders in the message with respective values
281 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
, typename ARGTYPE6
>
282 bool log( const sal_Int32 _nLogLevel
, const sal_Char
* _pMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
, ARGTYPE6 _argument6
) const
284 if ( isLoggable( _nLogLevel
) )
285 return impl_log( _nLogLevel
, nullptr, nullptr, OUString::createFromAscii( _pMessage
),
286 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
287 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
288 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
289 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
290 OptionalString( log::convert::convertLogArgToString( _argument5
) ),
291 OptionalString( log::convert::convertLogArgToString( _argument6
) ) );
296 //- XLogger::logp equivalents/wrappers
299 /** logs a given message, replacing a placeholder in the message with an argument
301 The function takes, additionally to the logp level and the message, an arbitrary
302 argument. This argument is converted to a string using an overloaded function
303 named <code>convertLogArgToString</code>. Then, a placeholder "$1$"
304 is searched in the message string, and replaced with the argument string.
306 template< typename ARGTYPE1
>
307 bool logp( const sal_Int32 _nLogLevel
, const sal_Char
* _pSourceClass
, const sal_Char
* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
) const
309 if ( isLoggable( _nLogLevel
) )
310 return impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
311 OptionalString( log::convert::convertLogArgToString( _argument1
) ) );
315 /// logs a given message, replacing 2 placeholders in the message with respective values
316 template< typename ARGTYPE1
, typename ARGTYPE2
>
317 bool logp( const sal_Int32 _nLogLevel
, const sal_Char
* _pSourceClass
, const sal_Char
* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
319 if ( isLoggable( _nLogLevel
) )
320 return impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
321 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
322 OptionalString( log::convert::convertLogArgToString( _argument2
) ) );
326 /// logs a given message, replacing 3 placeholders in the message with respective values
327 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
328 bool logp( const sal_Int32 _nLogLevel
, const sal_Char
* _pSourceClass
, const sal_Char
* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
) const
330 if ( isLoggable( _nLogLevel
) )
331 return impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
332 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
333 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
334 OptionalString( log::convert::convertLogArgToString( _argument3
) ) );
338 /// logs a given message, replacing 4 placeholders in the message with respective values
339 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
340 bool logp( const sal_Int32 _nLogLevel
, const sal_Char
* _pSourceClass
, const sal_Char
* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
) const
342 if ( isLoggable( _nLogLevel
) )
343 return impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
344 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
345 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
346 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
347 OptionalString( log::convert::convertLogArgToString( _argument4
) ) );
351 /// logs a given message, replacing 5 placeholders in the message with respective values
352 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
353 bool logp( const sal_Int32 _nLogLevel
, const sal_Char
* _pSourceClass
, const sal_Char
* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
) const
355 if ( isLoggable( _nLogLevel
) )
356 return impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
357 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
358 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
359 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
360 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
361 OptionalString( log::convert::convertLogArgToString( _argument5
) ) );
365 /// logs a given message, replacing 6 placeholders in the message with respective values
366 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
, typename ARGTYPE6
>
367 bool logp( const sal_Int32 _nLogLevel
, const sal_Char
* _pSourceClass
, const sal_Char
* _pSourceMethod
, const OUString
& _rMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
, ARGTYPE3 _argument3
, ARGTYPE4 _argument4
, ARGTYPE5 _argument5
, ARGTYPE6 _argument6
) const
369 if ( isLoggable( _nLogLevel
) )
370 return impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, _rMessage
,
371 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
372 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
373 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
374 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
375 OptionalString( log::convert::convertLogArgToString( _argument5
) ),
376 OptionalString( log::convert::convertLogArgToString( _argument6
) ) );
381 //- XLogger::logp equivalents/wrappers
384 /** logs a given ASCII message, replacing a placeholder in the message with an argument
386 The function takes, additionally to the logp level and the message, an arbitrary
387 argument. This argument is converted to a string using an overloaded function
388 named <code>convertLogArgToString</code>. Then, a placeholder "$1$"
389 is searched in the message string, and replaced with the argument string.
391 template< typename ARGTYPE1
>
392 bool logp( const sal_Int32 _nLogLevel
, const sal_Char
* _pSourceClass
, const sal_Char
* _pSourceMethod
, const sal_Char
* _pAsciiMessage
, ARGTYPE1 _argument1
) const
394 if ( isLoggable( _nLogLevel
) )
395 return impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
396 OptionalString( log::convert::convertLogArgToString( _argument1
) ) );
400 /// logs a given ASCII message, replacing 2 placeholders in the message with respective values
401 template< typename ARGTYPE1
, typename ARGTYPE2
>
402 bool logp( const sal_Int32 _nLogLevel
, const sal_Char
* _pSourceClass
, const sal_Char
* _pSourceMethod
, const sal_Char
* _pAsciiMessage
, ARGTYPE1 _argument1
, ARGTYPE2 _argument2
) const
404 if ( isLoggable( _nLogLevel
) )
405 return impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
406 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
407 OptionalString( log::convert::convertLogArgToString( _argument2
) ) );
411 /// logs a given ASCII message, replacing 3 placeholders in the message with respective values
412 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
>
413 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
415 if ( isLoggable( _nLogLevel
) )
416 return impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
417 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
418 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
419 OptionalString( log::convert::convertLogArgToString( _argument3
) ) );
423 /// logs a given ASCII message, replacing 4 placeholders in the message with respective values
424 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
>
425 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
427 if ( isLoggable( _nLogLevel
) )
428 return impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
429 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
430 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
431 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
432 OptionalString( log::convert::convertLogArgToString( _argument4
) ) );
436 /// logs a given ASCII message, replacing 5 placeholders in the message with respective values
437 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
>
438 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
440 if ( isLoggable( _nLogLevel
) )
441 return impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
442 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
443 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
444 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
445 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
446 OptionalString( log::convert::convertLogArgToString( _argument5
) ) );
450 /// logs a given ASCII message, replacing 6 placeholders in the message with respective values
451 template< typename ARGTYPE1
, typename ARGTYPE2
, typename ARGTYPE3
, typename ARGTYPE4
, typename ARGTYPE5
, typename ARGTYPE6
>
452 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
454 if ( isLoggable( _nLogLevel
) )
455 return impl_log( _nLogLevel
, _pSourceClass
, _pSourceMethod
, OUString::createFromAscii( _pAsciiMessage
),
456 OptionalString( log::convert::convertLogArgToString( _argument1
) ),
457 OptionalString( log::convert::convertLogArgToString( _argument2
) ),
458 OptionalString( log::convert::convertLogArgToString( _argument3
) ),
459 OptionalString( log::convert::convertLogArgToString( _argument4
) ),
460 OptionalString( log::convert::convertLogArgToString( _argument5
) ),
461 OptionalString( log::convert::convertLogArgToString( _argument6
) ) );
467 const sal_Int32 _nLogLevel
,
468 const sal_Char
* _pSourceClass
,
469 const sal_Char
* _pSourceMethod
,
470 const OUString
& _rMessage
,
471 const OptionalString
& _rArgument1
= OptionalString(),
472 const OptionalString
& _rArgument2
= OptionalString(),
473 const OptionalString
& _rArgument3
= OptionalString(),
474 const OptionalString
& _rArgument4
= OptionalString(),
475 const OptionalString
& _rArgument5
= OptionalString(),
476 const OptionalString
& _rArgument6
= OptionalString()
479 } // namespace comphelper
482 #endif // INCLUDED_COMPHELPER_LOGGING_HXX
484 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */