LibreOffice Module extensions (master) 1
|
#include <loghandler.hxx>
Public Member Functions | |
LogHandlerHelper (const css::uno::Reference< css::uno::XComponentContext > &_rxContext, ::osl::Mutex &_rMutex, ::cppu::OBroadcastHelper &_rBHelper) | |
void | setIsInitialized () |
bool | getEncoding (OUString &_out_rEncoding) const |
bool | setEncoding (std::u16string_view _rEncoding) |
rtl_TextEncoding | getTextEncoding () const |
const css::uno::Reference< css::logging::XLogFormatter > & | getFormatter () const |
void | setFormatter (const css::uno::Reference< css::logging::XLogFormatter > &_rxFormatter) |
sal_Int32 | getLevel () const |
void | setLevel (const sal_Int32 _nLevel) |
void | enterMethod () |
prepares implementation of a public accessible method of a log handler More... | |
bool | formatForPublishing (const css::logging::LogRecord &_rRecord, OString &_out_rEntry) const |
formats a record for publishing it More... | |
bool | getEncodedHead (OString &_out_rHead) const |
retrieves our formatter's heading, encoded with our encoding More... | |
bool | getEncodedTail (OString &_out_rTail) const |
retrieves our formatter's tail, encoded with our encoding More... | |
void | initFromSettings (const ::comphelper::NamedValueCollection &_rSettings) |
initializes the instance from a collection of named settings More... | |
Private Attributes | |
rtl_TextEncoding | m_eEncoding |
sal_Int32 | m_nLevel |
css::uno::Reference< css::logging::XLogFormatter > | m_xFormatter |
css::uno::Reference< css::uno::XComponentContext > | m_xContext |
::osl::Mutex & | m_rMutex |
::cppu::OBroadcastHelper & | m_rBHelper |
bool | m_bInitialized |
Definition at line 38 of file loghandler.hxx.
logging::LogHandlerHelper::LogHandlerHelper | ( | const css::uno::Reference< css::uno::XComponentContext > & | _rxContext, |
::osl::Mutex & | _rMutex, | ||
::cppu::OBroadcastHelper & | _rBHelper | ||
) |
Definition at line 47 of file loghandler.cxx.
void logging::LogHandlerHelper::enterMethod | ( | ) |
prepares implementation of a public accessible method of a log handler
enterMethod
does the following things:
Definition at line 72 of file loghandler.cxx.
References cppu::OBroadcastHelperVar< class container, class keyType >::bDisposed, DBG_UNHANDLED_EXCEPTION, Exception, getFormatter(), m_bInitialized, m_rBHelper, m_rMutex, m_xContext, and setFormatter().
bool logging::LogHandlerHelper::formatForPublishing | ( | const css::logging::LogRecord & | _rRecord, |
OString & | _out_rEntry | ||
) | const |
formats a record for publishing it
The method first checks whether the records log level is greater or equal our own log level. If not, <FALSE> is returned.
Second, our formatter is used to create a unicode string from the log record. If an error occurs during this, e.g. if the formatter is <NULL> or throws an exception during formatting, <FALSE> is returned.
Finally, the unicode string is encoded into a byte string, using our encoding setting. Then, <TRUE> is returned.
Definition at line 124 of file loghandler.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, getFormatter(), getLevel(), getTextEncoding(), and OUStringToOString().
bool logging::LogHandlerHelper::getEncodedHead | ( | OString & | _out_rHead | ) | const |
retrieves our formatter's heading, encoded with our encoding
Definition at line 145 of file loghandler.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, getFormatter(), getTextEncoding(), and OUStringToOString().
bool logging::LogHandlerHelper::getEncodedTail | ( | OString & | _out_rTail | ) | const |
retrieves our formatter's tail, encoded with our encoding
Definition at line 162 of file loghandler.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, getFormatter(), getTextEncoding(), and OUStringToOString().
bool logging::LogHandlerHelper::getEncoding | ( | OUString & | _out_rEncoding | ) | const |
Definition at line 98 of file loghandler.cxx.
References m_eEncoding.
|
inline |
Definition at line 71 of file loghandler.hxx.
References m_xFormatter.
Referenced by enterMethod(), formatForPublishing(), getEncodedHead(), and getEncodedTail().
|
inline |
Definition at line 79 of file loghandler.hxx.
References m_nLevel.
Referenced by formatForPublishing().
|
inline |
Definition at line 68 of file loghandler.hxx.
References m_eEncoding.
Referenced by formatForPublishing(), getEncodedHead(), and getEncodedTail().
void logging::LogHandlerHelper::initFromSettings | ( | const ::comphelper::NamedValueCollection & | _rSettings | ) |
initializes the instance from a collection of named settings
The recognized named settings are Encoding
, Formatter
, and Level
, which initialize the respective attributes.
Settings which are recognized are remove from the given collection. This allows the caller to determine whether or not the collection contained any unsupported items, and react appropriately.
IllegalArgumentException | if one of the values in the collection is of wrong type. |
Definition at line 58 of file loghandler.cxx.
References m_nLevel, m_xFormatter, and setEncoding().
bool logging::LogHandlerHelper::setEncoding | ( | std::u16string_view | _rEncoding | ) |
Definition at line 111 of file loghandler.cxx.
References m_eEncoding, and OUStringToOString().
Referenced by initFromSettings().
|
inline |
|
inline |
Definition at line 62 of file loghandler.hxx.
References m_bInitialized.
|
inline |
Definition at line 81 of file loghandler.hxx.
References m_nLevel.
|
private |
Definition at line 52 of file loghandler.hxx.
Referenced by enterMethod(), and setIsInitialized().
|
private |
Definition at line 42 of file loghandler.hxx.
Referenced by getEncoding(), getTextEncoding(), and setEncoding().
|
private |
Definition at line 43 of file loghandler.hxx.
Referenced by getLevel(), initFromSettings(), and setLevel().
|
private |
Definition at line 51 of file loghandler.hxx.
Referenced by enterMethod().
|
private |
Definition at line 50 of file loghandler.hxx.
Referenced by enterMethod().
|
private |
Definition at line 49 of file loghandler.hxx.
Referenced by enterMethod().
|
private |
Definition at line 45 of file loghandler.hxx.
Referenced by getFormatter(), initFromSettings(), and setFormatter().