diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-27 16:35:05 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-27 16:35:07 +0100 |
commit | 2c6eb5dcadc77c4e6af0d03c69267859b1f853b5 (patch) | |
tree | 01e80385dd604e6714c171e026d8324caf1ec4e1 | |
parent | a70dd5c57b32bef0040daa92bbfa8c00a3bf22f2 (diff) |
remove ResourceBasedEventLogger in favor of its base EventLogger
because there are no resources in use anymore
Change-Id: I37e4a100aabbf6214533738da3e528ed2f434eae
-rw-r--r-- | comphelper/source/misc/logging.cxx | 13 | ||||
-rw-r--r-- | connectivity/source/drivers/jdbc/ConnectionLog.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/jdbc/ContextClassLoader.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/drivers/jdbc/Object.cxx | 2 | ||||
-rw-r--r-- | connectivity/source/inc/java/ContextClassLoader.hxx | 4 | ||||
-rw-r--r-- | connectivity/source/inc/java/lang/Object.hxx | 4 | ||||
-rw-r--r-- | connectivity/source/inc/java/sql/ConnectionLog.hxx | 4 | ||||
-rw-r--r-- | connectivity/source/inc/java/sql/Driver.hxx | 4 | ||||
-rw-r--r-- | include/comphelper/logging.hxx | 125 |
9 files changed, 19 insertions, 141 deletions
diff --git a/comphelper/source/misc/logging.cxx b/comphelper/source/misc/logging.cxx index 0c00d9feb486..6df71c3d01bf 100644 --- a/comphelper/source/misc/logging.cxx +++ b/comphelper/source/misc/logging.cxx @@ -22,9 +22,6 @@ #include <com/sun/star/logging/LoggerPool.hpp> #include <com/sun/star/logging/LogLevel.hpp> -#include <com/sun/star/resource/OfficeResourceLoader.hpp> -#include <com/sun/star/resource/XResourceBundle.hpp> -#include <com/sun/star/resource/XResourceBundleLoader.hpp> #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> @@ -32,8 +29,6 @@ namespace comphelper { - - using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::logging::XLoggerPool; @@ -41,8 +36,6 @@ namespace comphelper using ::com::sun::star::logging::XLogger; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::Exception; - using ::com::sun::star::resource::XResourceBundle; - using ::com::sun::star::resource::XResourceBundleLoader; class EventLogger_Impl { @@ -172,12 +165,6 @@ namespace comphelper return false; } - - ResourceBasedEventLogger::ResourceBasedEventLogger( const Reference< XComponentContext >& _rxContext, - const sal_Char* _pAsciiLoggerName ) - :EventLogger( _rxContext, _pAsciiLoggerName ) - { - } } // namespace comphelper diff --git a/connectivity/source/drivers/jdbc/ConnectionLog.cxx b/connectivity/source/drivers/jdbc/ConnectionLog.cxx index b84132c880b1..f91f11b923f2 100644 --- a/connectivity/source/drivers/jdbc/ConnectionLog.cxx +++ b/connectivity/source/drivers/jdbc/ConnectionLog.cxx @@ -42,7 +42,7 @@ namespace connectivity { namespace java { namespace sql { } } - ConnectionLog::ConnectionLog( const ::comphelper::ResourceBasedEventLogger& _rDriverLog ) + ConnectionLog::ConnectionLog( const ::comphelper::EventLogger& _rDriverLog ) :ConnectionLog_Base( _rDriverLog ) ,m_nObjectID( lcl_getFreeID( CONNECTION ) ) { diff --git a/connectivity/source/drivers/jdbc/ContextClassLoader.cxx b/connectivity/source/drivers/jdbc/ContextClassLoader.cxx index 6c2d37122e5a..5f1d1349fb26 100644 --- a/connectivity/source/drivers/jdbc/ContextClassLoader.cxx +++ b/connectivity/source/drivers/jdbc/ContextClassLoader.cxx @@ -31,7 +31,7 @@ namespace connectivity { namespace jdbc using ::connectivity::java_lang_Object; ContextClassLoaderScope::ContextClassLoaderScope( JNIEnv& environment, const GlobalRef< jobject >& newClassLoader, - const ::comphelper::ResourceBasedEventLogger& _rLoggerForErrors, const Reference< XInterface >& _rxErrorContext ) + const ::comphelper::EventLogger& _rLoggerForErrors, const Reference< XInterface >& _rxErrorContext ) :m_environment( environment ) ,m_currentThread( environment ) ,m_oldContextClassLoader( environment ) diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx index 0ddd162b8727..4f68ea755701 100644 --- a/connectivity/source/drivers/jdbc/Object.cxx +++ b/connectivity/source/drivers/jdbc/Object.cxx @@ -198,7 +198,7 @@ namespace } -void java_lang_Object::ThrowLoggedSQLException( const ::comphelper::ResourceBasedEventLogger& _rLogger, JNIEnv* _pEnvironment, +void java_lang_Object::ThrowLoggedSQLException( const ::comphelper::EventLogger& _rLogger, JNIEnv* _pEnvironment, const Reference< XInterface >& _rxContext ) { SQLException aException; diff --git a/connectivity/source/inc/java/ContextClassLoader.hxx b/connectivity/source/inc/java/ContextClassLoader.hxx index 174c3e9377ea..5ad955e67e07 100644 --- a/connectivity/source/inc/java/ContextClassLoader.hxx +++ b/connectivity/source/inc/java/ContextClassLoader.hxx @@ -24,7 +24,7 @@ namespace comphelper { - class ResourceBasedEventLogger; + class EventLogger; } @@ -51,7 +51,7 @@ namespace connectivity { namespace jdbc ContextClassLoaderScope( JNIEnv& environment, const GlobalRef< jobject >& newClassLoader, - const ::comphelper::ResourceBasedEventLogger& _rLoggerForErrors, + const ::comphelper::EventLogger& _rLoggerForErrors, const css::uno::Reference< css::uno::XInterface >& _rxErrorContext ); diff --git a/connectivity/source/inc/java/lang/Object.hxx b/connectivity/source/inc/java/lang/Object.hxx index c1476e77995f..f7d136ceacc0 100644 --- a/connectivity/source/inc/java/lang/Object.hxx +++ b/connectivity/source/inc/java/lang/Object.hxx @@ -35,7 +35,7 @@ namespace comphelper { - class ResourceBasedEventLogger; + class EventLogger; } namespace connectivity @@ -97,7 +97,7 @@ namespace connectivity static void ThrowSQLException(JNIEnv * pEnv,const css::uno::Reference< css::uno::XInterface> & _rContext); static void ThrowLoggedSQLException( - const ::comphelper::ResourceBasedEventLogger& _rLogger, + const ::comphelper::EventLogger& _rLogger, JNIEnv* pEnvironment, const css::uno::Reference< css::uno::XInterface >& _rxContext ); diff --git a/connectivity/source/inc/java/sql/ConnectionLog.hxx b/connectivity/source/inc/java/sql/ConnectionLog.hxx index 5871f3b09823..416c17014971 100644 --- a/connectivity/source/inc/java/sql/ConnectionLog.hxx +++ b/connectivity/source/inc/java/sql/ConnectionLog.hxx @@ -58,7 +58,7 @@ namespace connectivity namespace connectivity { namespace java { namespace sql { - typedef ::comphelper::ResourceBasedEventLogger ConnectionLog_Base; + typedef ::comphelper::EventLogger ConnectionLog_Base; class ConnectionLog : public ConnectionLog_Base { public: @@ -76,7 +76,7 @@ namespace connectivity { namespace java { namespace sql { public: /// will construct an instance of ObjectType CONNECTION - ConnectionLog( const ::comphelper::ResourceBasedEventLogger& _rDriverLog ); + ConnectionLog( const ::comphelper::EventLogger & _rDriverLog ); /// will create an instance with the same object ID / ObjectType as a given source instance ConnectionLog( const ConnectionLog& _rSourceLog ); /// will create an instance of arbitrary ObjectType diff --git a/connectivity/source/inc/java/sql/Driver.hxx b/connectivity/source/inc/java/sql/Driver.hxx index 8e1a20aa70b9..a295ffd83557 100644 --- a/connectivity/source/inc/java/sql/Driver.hxx +++ b/connectivity/source/inc/java/sql/Driver.hxx @@ -35,7 +35,7 @@ namespace connectivity class java_sql_Driver : public ::cppu::WeakImplHelper< css::sdbc::XDriver,css::lang::XServiceInfo> { css::uno::Reference<css::uno::XComponentContext> m_aContext; - ::comphelper::ResourceBasedEventLogger m_aLogger; + ::comphelper::EventLogger m_aLogger; protected: virtual ~java_sql_Driver() override; @@ -61,7 +61,7 @@ namespace connectivity virtual sal_Int32 SAL_CALL getMinorVersion( ) override; const css::uno::Reference<css::uno::XComponentContext>& getContext() const { return m_aContext; } - const ::comphelper::ResourceBasedEventLogger& getLogger() const { return m_aLogger; } + const ::comphelper::EventLogger& getLogger() const { return m_aLogger; } }; } diff --git a/include/comphelper/logging.hxx b/include/comphelper/logging.hxx index cd74d24d569a..0d71620e136d 100644 --- a/include/comphelper/logging.hxx +++ b/include/comphelper/logging.hxx @@ -118,6 +118,14 @@ namespace comphelper //- XLogger::log equivalents/wrappers //- string messages + /// logs a given message, without any arguments, or source class/method names + bool log( const sal_Int32 _nLogLevel, const OUString& rMessage ) const + { + if ( isLoggable( _nLogLevel ) ) + return impl_log(_nLogLevel, nullptr, nullptr, rMessage); + return false; + } + /** 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 @@ -468,123 +476,6 @@ namespace comphelper const OptionalString& _rArgument6 = OptionalString() ) const; }; - - - //= ResourceBasedEventLogger - - /** extends the EventLogger class with functionality to load log messages from - a resource bundle. - */ - class COMPHELPER_DLLPUBLIC ResourceBasedEventLogger : public EventLogger - { - public: - /** creates a resource based event logger - @param _rxContext - the component context for creating new components - @param _pAsciiLoggerName - the ASCII name of the logger to work with. If NULL, the office-wide - default logger will be used. - - */ - ResourceBasedEventLogger( - const css::uno::Reference< css::uno::XComponentContext >& _rxContext, - const sal_Char* _pAsciiLoggerName - ); - - //- XLogger::log equivalents/wrappers - //- resource IDs - - /// logs a given message, without any arguments, or source class/method names - bool log( const sal_Int32 _nLogLevel, const OUString& rMessage ) const - { - if ( isLoggable( _nLogLevel ) ) - return impl_log(_nLogLevel, nullptr, nullptr, rMessage); - return false; - } - - /** 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 <code>convertLogArgToString</code>. Then, a placeholder "$1$" - is searched in the message string, and replaced with the argument string. - */ - template< typename ARGTYPE1 > - bool log( const sal_Int32 _nLogLevel, const OUString& rMessage, ARGTYPE1 _argument1 ) const - { - if ( isLoggable( _nLogLevel ) ) - return impl_log( _nLogLevel, nullptr, nullptr, rMessage, - OptionalString( log::convert::convertLogArgToString( _argument1 ) ) ); - return false; - } - - /// logs a given message, replacing 2 placeholders in the message with respective values - template< typename ARGTYPE1, typename ARGTYPE2 > - bool log( const sal_Int32 _nLogLevel, const OUString& rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const - { - if ( isLoggable( _nLogLevel ) ) - return impl_log( _nLogLevel, nullptr, nullptr, rMessage, - OptionalString( log::convert::convertLogArgToString( _argument1 ) ), - OptionalString( log::convert::convertLogArgToString( _argument2 ) ) ); - return false; - } - - /// logs a given message, replacing 3 placeholders in the message with respective values - template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 > - bool log( const sal_Int32 _nLogLevel, const OUString& rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const - { - if ( isLoggable( _nLogLevel ) ) - return impl_log( _nLogLevel, nullptr, nullptr, rMessage, - OptionalString( log::convert::convertLogArgToString( _argument1 ) ), - OptionalString( log::convert::convertLogArgToString( _argument2 ) ), - OptionalString( log::convert::convertLogArgToString( _argument3 ) ) ); - return false; - } - - /// logs a given message, replacing 4 placeholders in the message with respective values - template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 > - bool log( const sal_Int32 _nLogLevel, const OUString& rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const - { - if ( isLoggable( _nLogLevel ) ) - return impl_log( _nLogLevel, nullptr, nullptr, rMessage, - OptionalString( log::convert::convertLogArgToString( _argument1 ) ), - OptionalString( log::convert::convertLogArgToString( _argument2 ) ), - OptionalString( log::convert::convertLogArgToString( _argument3 ) ), - OptionalString( log::convert::convertLogArgToString( _argument4 ) ) ); - return false; - } - - /// logs a given message, replacing 5 placeholders in the message with respective values - template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 > - bool log( const sal_Int32 _nLogLevel, const OUString& rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const - { - if ( isLoggable( _nLogLevel ) ) - return impl_log( _nLogLevel, nullptr, nullptr, rMessage, - OptionalString( log::convert::convertLogArgToString( _argument1 ) ), - OptionalString( log::convert::convertLogArgToString( _argument2 ) ), - OptionalString( log::convert::convertLogArgToString( _argument3 ) ), - OptionalString( log::convert::convertLogArgToString( _argument4 ) ), - OptionalString( log::convert::convertLogArgToString( _argument5 ) ) ); - return false; - } - - /// logs a given message, replacing 6 placeholders in the message with respective values - template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 > - bool log( const sal_Int32 _nLogLevel, const OUString& rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const - { - if ( isLoggable( _nLogLevel ) ) - return impl_log( _nLogLevel, nullptr, nullptr, rMessage, - OptionalString( log::convert::convertLogArgToString( _argument1 ) ), - OptionalString( log::convert::convertLogArgToString( _argument2 ) ), - OptionalString( log::convert::convertLogArgToString( _argument3 ) ), - OptionalString( log::convert::convertLogArgToString( _argument4 ) ), - OptionalString( log::convert::convertLogArgToString( _argument5 ) ), - OptionalString( log::convert::convertLogArgToString( _argument6 ) ) ); - return false; - } - }; - - } // namespace comphelper |