LibreOffice Module comphelper (master) 1
|
encapsulates a css::logging::XLogger More...
#include <logging.hxx>
Public Member Functions | |
EventLogger (const css::uno::Reference< css::uno::XComponentContext > &_rxContext, const char *_pAsciiLoggerName) | |
creates an EventLogger instance working with a css.logging.XLogger instance given by ASCII name. More... | |
bool | isLoggable (const sal_Int32 _nLogLevel) const |
determines whether an event with the given level would be logged More... | |
void | log (const sal_Int32 _nLogLevel, const OUString &rMessage) const |
logs a given message, without any arguments, or source class/method names More... | |
const css::uno::Reference< css::logging::XLogger > & | getLogger () const |
template<typename ARGTYPE1 > | |
void | log (const sal_Int32 _nLogLevel, const OUString &_rMessage, ARGTYPE1 _argument1) const |
logs a given message, replacing a placeholder in the message with an argument More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 > | |
void | log (const sal_Int32 _nLogLevel, const OUString &_rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2) const |
logs a given message, replacing 2 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 > | |
void | log (const sal_Int32 _nLogLevel, const OUString &_rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3) const |
logs a given message, replacing 3 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 , typename ARGTYPE4 > | |
void | log (const sal_Int32 _nLogLevel, const OUString &_rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4) const |
logs a given message, replacing 4 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 , typename ARGTYPE4 , typename ARGTYPE5 > | |
void | log (const sal_Int32 _nLogLevel, const OUString &_rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5) const |
logs a given message, replacing 5 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 , typename ARGTYPE4 , typename ARGTYPE5 , typename ARGTYPE6 > | |
void | log (const sal_Int32 _nLogLevel, const OUString &_rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6) const |
logs a given message, replacing 6 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 > | |
void | log (const sal_Int32 _nLogLevel, const char *_pMessage, ARGTYPE1 _argument1) const |
logs a given message, replacing a placeholder in the message with an argument More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 > | |
void | log (const sal_Int32 _nLogLevel, const char *_pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2) const |
logs a given message, replacing 2 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 > | |
void | log (const sal_Int32 _nLogLevel, const char *_pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3) const |
logs a given message, replacing 3 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 , typename ARGTYPE4 > | |
void | log (const sal_Int32 _nLogLevel, const char *_pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4) const |
logs a given message, replacing 4 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 , typename ARGTYPE4 , typename ARGTYPE5 > | |
void | log (const sal_Int32 _nLogLevel, const char *_pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5) const |
logs a given message, replacing 5 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 , typename ARGTYPE4 , typename ARGTYPE5 , typename ARGTYPE6 > | |
void | log (const sal_Int32 _nLogLevel, const char *_pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6) const |
logs a given message, replacing 6 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 > | |
void | logp (const sal_Int32 _nLogLevel, const char *_pSourceClass, const char *_pSourceMethod, const OUString &_rMessage, ARGTYPE1 _argument1) const |
logs a given message, replacing a placeholder in the message with an argument More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 > | |
void | logp (const sal_Int32 _nLogLevel, const char *_pSourceClass, const char *_pSourceMethod, const OUString &_rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2) const |
logs a given message, replacing 2 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 > | |
void | logp (const sal_Int32 _nLogLevel, const char *_pSourceClass, const char *_pSourceMethod, const OUString &_rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3) const |
logs a given message, replacing 3 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 , typename ARGTYPE4 > | |
void | logp (const sal_Int32 _nLogLevel, const char *_pSourceClass, const char *_pSourceMethod, const OUString &_rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4) const |
logs a given message, replacing 4 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 , typename ARGTYPE4 , typename ARGTYPE5 > | |
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 |
logs a given message, replacing 5 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 , typename ARGTYPE4 , typename ARGTYPE5 , typename ARGTYPE6 > | |
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 |
logs a given message, replacing 6 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 > | |
void | logp (const sal_Int32 _nLogLevel, const char *_pSourceClass, const char *_pSourceMethod, const char *_pAsciiMessage, ARGTYPE1 _argument1) const |
logs a given ASCII message, replacing a placeholder in the message with an argument More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 > | |
void | logp (const sal_Int32 _nLogLevel, const char *_pSourceClass, const char *_pSourceMethod, const char *_pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2) const |
logs a given ASCII message, replacing 2 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 > | |
void | logp (const sal_Int32 _nLogLevel, const char *_pSourceClass, const char *_pSourceMethod, const char *_pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3) const |
logs a given ASCII message, replacing 3 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 , typename ARGTYPE4 > | |
void | logp (const sal_Int32 _nLogLevel, const char *_pSourceClass, const char *_pSourceMethod, const char *_pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4) const |
logs a given ASCII message, replacing 4 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 , typename ARGTYPE4 , typename ARGTYPE5 > | |
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 |
logs a given ASCII message, replacing 5 placeholders in the message with respective values More... | |
template<typename ARGTYPE1 , typename ARGTYPE2 , typename ARGTYPE3 , typename ARGTYPE4 , typename ARGTYPE5 , typename ARGTYPE6 > | |
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 |
logs a given ASCII message, replacing 6 placeholders in the message with respective values More... | |
Protected Member Functions | |
void | impl_log (const sal_Int32 _nLogLevel, const char *_pSourceClass, const char *_pSourceMethod, const OUString &_rMessage, const OptionalString &_rArgument1=OptionalString(), const OptionalString &_rArgument2=OptionalString(), const OptionalString &_rArgument3=OptionalString(), const OptionalString &_rArgument4=OptionalString(), const OptionalString &_rArgument5=OptionalString(), const OptionalString &_rArgument6=OptionalString()) const |
Private Attributes | |
std::shared_ptr< EventLogger_Impl > | m_pImpl |
encapsulates a css::logging::XLogger
The class silences several (unlikely) errors which could potentially happen when working with a logger. Additionally, it provides some convenience methods for logging events.
You can use this class as follows
The <code>log</code> and <code>logp</code> calls support up to 6 parameters, which can be of arbitrary type. For every parameter, there must exist a function <code>convertLogArgToString</code> which takes an argument of the respective type, and returns a string. After a parameter has been converted to a string using the above mentioned <code>convertLogArgToString</code> function, a placeholder $1$ (resp. $2$ resp. $4$ ...) in the message will be replaced with this string, and the resulting message will be logged.
Definition at line 92 of file logging.hxx.
comphelper::EventLogger::EventLogger | ( | const css::uno::Reference< css::uno::XComponentContext > & | _rxContext, |
const char * | _pAsciiLoggerName | ||
) |
creates an EventLogger
instance working with a css.logging.XLogger instance given by ASCII name.
_rxContext | the component context to create services |
_rLoggerName | the ASCII name of the logger to create. |
Definition at line 69 of file logging.cxx.
References m_pImpl, and make_shared().
const css::uno::Reference< css::logging::XLogger > & comphelper::EventLogger::getLogger | ( | ) | const |
Definition at line 91 of file logging.cxx.
References m_pImpl.
|
protected |
Definition at line 111 of file logging.cxx.
References Exception, m_pImpl, sMessage, and TOOLS_WARN_EXCEPTION.
bool comphelper::EventLogger::isLoggable | ( | const sal_Int32 | _nLogLevel | ) | const |
determines whether an event with the given level would be logged
Definition at line 74 of file logging.cxx.
References Exception, m_pImpl, and TOOLS_WARN_EXCEPTION.
|
inline |
logs a given message, replacing a placeholder in the message with an argument
The function takes, additionally to the log level and the message, an arbitrary argument. This argument is converted to a string using an overloaded function named convertLogArgToString
. Then, a placeholder "$1$" is searched in the message string, and replaced with the argument string.
Definition at line 215 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 2 placeholders in the message with respective values
Definition at line 224 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 3 placeholders in the message with respective values
Definition at line 234 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 4 placeholders in the message with respective values
Definition at line 245 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 5 placeholders in the message with respective values
Definition at line 257 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 6 placeholders in the message with respective values
Definition at line 270 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing a placeholder in the message with an argument
The function takes, additionally to the log level and the message, an arbitrary argument. This argument is converted to a string using an overloaded function named convertLogArgToString
. Then, a placeholder "$1$" is searched in the message string, and replaced with the argument string.
Definition at line 136 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 2 placeholders in the message with respective values
Definition at line 145 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 3 placeholders in the message with respective values
Definition at line 155 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 4 placeholders in the message with respective values
Definition at line 166 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 5 placeholders in the message with respective values
Definition at line 178 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 6 placeholders in the message with respective values
Definition at line 191 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, without any arguments, or source class/method names
Definition at line 120 of file logging.hxx.
|
inline |
logs a given ASCII message, replacing a placeholder in the message with an argument
The function takes, additionally to the logp level and the message, an arbitrary argument. This argument is converted to a string using an overloaded function named convertLogArgToString
. Then, a placeholder "$1$" is searched in the message string, and replaced with the argument string.
Definition at line 373 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given ASCII message, replacing 2 placeholders in the message with respective values
Definition at line 382 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given ASCII message, replacing 3 placeholders in the message with respective values
Definition at line 392 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given ASCII message, replacing 4 placeholders in the message with respective values
Definition at line 403 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given ASCII message, replacing 5 placeholders in the message with respective values
Definition at line 415 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given ASCII message, replacing 6 placeholders in the message with respective values
Definition at line 428 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing a placeholder in the message with an argument
The function takes, additionally to the logp level and the message, an arbitrary argument. This argument is converted to a string using an overloaded function named convertLogArgToString
. Then, a placeholder "$1$" is searched in the message string, and replaced with the argument string.
Definition at line 294 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 2 placeholders in the message with respective values
Definition at line 303 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 3 placeholders in the message with respective values
Definition at line 313 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 4 placeholders in the message with respective values
Definition at line 324 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 5 placeholders in the message with respective values
Definition at line 336 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
inline |
logs a given message, replacing 6 placeholders in the message with respective values
Definition at line 349 of file logging.hxx.
References comphelper::log::convert::convertLogArgToString().
|
private |
Definition at line 94 of file logging.hxx.
Referenced by getLogger(), impl_log(), and isLoggable().