comphelper/source/misc/logging.cxx |   35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

New commits:
commit 2a6ca136a151d23e0b651b308549dfe98188b160
Author:     Caolán McNamara <[email protected]>
AuthorDate: Sat Jan 6 19:03:52 2024 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Sat Jan 6 22:23:48 2024 +0100

    cid#1560051 Missing move assignment operator
    
    Change-Id: Ie59d391cd68f9d90fd8ac99a81ba8b997221165a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161716
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/comphelper/source/misc/logging.cxx 
b/comphelper/source/misc/logging.cxx
index 3bce820a82ac..ae150290bedd 100644
--- a/comphelper/source/misc/logging.cxx
+++ b/comphelper/source/misc/logging.cxx
@@ -48,24 +48,33 @@ namespace comphelper
         const Reference< XLogger >& getLogger() const { return m_xLogger; }
     };
 
-    EventLogger_Impl::EventLogger_Impl( const Reference< XComponentContext >& 
_rxContext, const OUString& _rLoggerName )
-        :m_aContext( _rxContext )
+    namespace
     {
-        try
+        Reference<XLogger> createLogger(const Reference<XComponentContext>& 
rxContext, const OUString& rLoggerName)
         {
-            Reference< XLoggerPool > xPool( LoggerPool::get( m_aContext ) );
-            if ( !_rLoggerName.isEmpty() )
-                m_xLogger = xPool->getNamedLogger( _rLoggerName );
-            else
-                m_xLogger = xPool->getDefaultLogger();
-        }
-        catch( const Exception& )
-        {
-            TOOLS_WARN_EXCEPTION(
-                "comphelper", "EventLogger_Impl::impl_createLogger_nothrow: 
caught an exception!" );
+            try
+            {
+                Reference<XLoggerPool> xPool(LoggerPool::get(rxContext));
+                if (!rLoggerName.isEmpty())
+                    return xPool->getNamedLogger(rLoggerName);
+                else
+                    return xPool->getDefaultLogger();
+            }
+            catch( const Exception& )
+            {
+                TOOLS_WARN_EXCEPTION(
+                    "comphelper", 
"EventLogger_Impl::impl_createLogger_nothrow: caught an exception!" );
+            }
+            return Reference<XLogger>();
         }
     }
 
+    EventLogger_Impl::EventLogger_Impl(const Reference< XComponentContext >& 
_rxContext, const OUString& rLoggerName)
+        : m_aContext(_rxContext)
+        , m_xLogger(createLogger(_rxContext, rLoggerName))
+    {
+    }
+
     EventLogger::EventLogger( const Reference< XComponentContext >& 
_rxContext, const char* _pAsciiLoggerName )
         :m_pImpl( std::make_shared<EventLogger_Impl>( _rxContext, 
OUString::createFromAscii( _pAsciiLoggerName ) ) )
     {

Reply via email to