Kaydet (Commit) 2c6eb5dc authored tarafından Caolán McNamara's avatar Caolán McNamara

remove ResourceBasedEventLogger in favor of its base EventLogger

because there are no resources in use anymore

Change-Id: I37e4a100aabbf6214533738da3e528ed2f434eae
üst a70dd5c5
...@@ -22,9 +22,6 @@ ...@@ -22,9 +22,6 @@
#include <com/sun/star/logging/LoggerPool.hpp> #include <com/sun/star/logging/LoggerPool.hpp>
#include <com/sun/star/logging/LogLevel.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 <osl/diagnose.h>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
...@@ -32,8 +29,6 @@ ...@@ -32,8 +29,6 @@
namespace comphelper namespace comphelper
{ {
using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::logging::XLoggerPool; using ::com::sun::star::logging::XLoggerPool;
...@@ -41,8 +36,6 @@ namespace comphelper ...@@ -41,8 +36,6 @@ namespace comphelper
using ::com::sun::star::logging::XLogger; using ::com::sun::star::logging::XLogger;
using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::Exception;
using ::com::sun::star::resource::XResourceBundle;
using ::com::sun::star::resource::XResourceBundleLoader;
class EventLogger_Impl class EventLogger_Impl
{ {
...@@ -172,12 +165,6 @@ namespace comphelper ...@@ -172,12 +165,6 @@ namespace comphelper
return false; return false;
} }
ResourceBasedEventLogger::ResourceBasedEventLogger( const Reference< XComponentContext >& _rxContext,
const sal_Char* _pAsciiLoggerName )
:EventLogger( _rxContext, _pAsciiLoggerName )
{
}
} // namespace comphelper } // namespace comphelper
......
...@@ -42,7 +42,7 @@ namespace connectivity { namespace java { namespace sql { ...@@ -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 ) :ConnectionLog_Base( _rDriverLog )
,m_nObjectID( lcl_getFreeID( CONNECTION ) ) ,m_nObjectID( lcl_getFreeID( CONNECTION ) )
{ {
......
...@@ -31,7 +31,7 @@ namespace connectivity { namespace jdbc ...@@ -31,7 +31,7 @@ namespace connectivity { namespace jdbc
using ::connectivity::java_lang_Object; using ::connectivity::java_lang_Object;
ContextClassLoaderScope::ContextClassLoaderScope( JNIEnv& environment, const GlobalRef< jobject >& newClassLoader, 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_environment( environment )
,m_currentThread( environment ) ,m_currentThread( environment )
,m_oldContextClassLoader( environment ) ,m_oldContextClassLoader( environment )
......
...@@ -198,7 +198,7 @@ namespace ...@@ -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 ) const Reference< XInterface >& _rxContext )
{ {
SQLException aException; SQLException aException;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
namespace comphelper namespace comphelper
{ {
class ResourceBasedEventLogger; class EventLogger;
} }
...@@ -51,7 +51,7 @@ namespace connectivity { namespace jdbc ...@@ -51,7 +51,7 @@ namespace connectivity { namespace jdbc
ContextClassLoaderScope( ContextClassLoaderScope(
JNIEnv& environment, JNIEnv& environment,
const GlobalRef< jobject >& newClassLoader, const GlobalRef< jobject >& newClassLoader,
const ::comphelper::ResourceBasedEventLogger& _rLoggerForErrors, const ::comphelper::EventLogger& _rLoggerForErrors,
const css::uno::Reference< css::uno::XInterface >& _rxErrorContext const css::uno::Reference< css::uno::XInterface >& _rxErrorContext
); );
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
namespace comphelper namespace comphelper
{ {
class ResourceBasedEventLogger; class EventLogger;
} }
namespace connectivity namespace connectivity
...@@ -97,7 +97,7 @@ namespace connectivity ...@@ -97,7 +97,7 @@ namespace connectivity
static void ThrowSQLException(JNIEnv * pEnv,const css::uno::Reference< css::uno::XInterface> & _rContext); static void ThrowSQLException(JNIEnv * pEnv,const css::uno::Reference< css::uno::XInterface> & _rContext);
static void ThrowLoggedSQLException( static void ThrowLoggedSQLException(
const ::comphelper::ResourceBasedEventLogger& _rLogger, const ::comphelper::EventLogger& _rLogger,
JNIEnv* pEnvironment, JNIEnv* pEnvironment,
const css::uno::Reference< css::uno::XInterface >& _rxContext const css::uno::Reference< css::uno::XInterface >& _rxContext
); );
......
...@@ -58,7 +58,7 @@ namespace connectivity ...@@ -58,7 +58,7 @@ namespace connectivity
namespace connectivity { namespace java { namespace sql { namespace connectivity { namespace java { namespace sql {
typedef ::comphelper::ResourceBasedEventLogger ConnectionLog_Base; typedef ::comphelper::EventLogger ConnectionLog_Base;
class ConnectionLog : public ConnectionLog_Base class ConnectionLog : public ConnectionLog_Base
{ {
public: public:
...@@ -76,7 +76,7 @@ namespace connectivity { namespace java { namespace sql { ...@@ -76,7 +76,7 @@ namespace connectivity { namespace java { namespace sql {
public: public:
/// will construct an instance of ObjectType CONNECTION /// 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 /// will create an instance with the same object ID / ObjectType as a given source instance
ConnectionLog( const ConnectionLog& _rSourceLog ); ConnectionLog( const ConnectionLog& _rSourceLog );
/// will create an instance of arbitrary ObjectType /// will create an instance of arbitrary ObjectType
......
...@@ -35,7 +35,7 @@ namespace connectivity ...@@ -35,7 +35,7 @@ namespace connectivity
class java_sql_Driver : public ::cppu::WeakImplHelper< css::sdbc::XDriver,css::lang::XServiceInfo> class java_sql_Driver : public ::cppu::WeakImplHelper< css::sdbc::XDriver,css::lang::XServiceInfo>
{ {
css::uno::Reference<css::uno::XComponentContext> m_aContext; css::uno::Reference<css::uno::XComponentContext> m_aContext;
::comphelper::ResourceBasedEventLogger m_aLogger; ::comphelper::EventLogger m_aLogger;
protected: protected:
virtual ~java_sql_Driver() override; virtual ~java_sql_Driver() override;
...@@ -61,7 +61,7 @@ namespace connectivity ...@@ -61,7 +61,7 @@ namespace connectivity
virtual sal_Int32 SAL_CALL getMinorVersion( ) override; virtual sal_Int32 SAL_CALL getMinorVersion( ) override;
const css::uno::Reference<css::uno::XComponentContext>& getContext() const { return m_aContext; } 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; }
}; };
} }
......
...@@ -118,6 +118,14 @@ namespace comphelper ...@@ -118,6 +118,14 @@ namespace comphelper
//- XLogger::log equivalents/wrappers //- XLogger::log equivalents/wrappers
//- string messages //- 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 /** 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 The function takes, additionally to the log level and the message, an arbitrary
...@@ -468,123 +476,6 @@ namespace comphelper ...@@ -468,123 +476,6 @@ namespace comphelper
const OptionalString& _rArgument6 = OptionalString() const OptionalString& _rArgument6 = OptionalString()
) const; ) 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 &quot;$1$&quot;
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 } // namespace comphelper
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment