rm5248 commented on a change in pull request #90:
URL: https://github.com/apache/logging-log4cxx/pull/90#discussion_r777154659



##########
File path: src/main/include/log4cxx/logger.h
##########
@@ -617,13 +617,13 @@ class LOG4CXX_EXPORT Logger :
 
                @throws RuntimeException if all levels are null in the hierarchy
                */
-               virtual const LevelPtr getEffectiveLevel() const;
+               virtual const LevelPtr& getEffectiveLevel() const;
 
                /**
                Return the the LoggerRepository where this
                <code>Logger</code> is attached.
                */
-               log4cxx::spi::LoggerRepositoryWeakPtr getLoggerRepository() 
const;
+               log4cxx::spi::LoggerRepository* getLoggerRepository() const;

Review comment:
       I agree that using the raw pointer would be faster, but what I'm saying 
is why don't we store the raw pointer and the weak pointer?  That lets the API 
stay stable, plus gives us the benefits of speed since we only use the raw 
pointer.
   
   pseudo-code:
   Logger.h:
   ```
   private:
     log4cxx::spi::LoggerRepositoryWeakPtr repository;
     log4cxx::spi::LoggerRepository* repository_raw;
   ```
   Logger.cpp:
   ```
   void Logger::setHierarchy(spi::LoggerRepositoryWeakPtr repository1)
   {
        this->repository = repository1;
           this->repository_raw = repository1.lock().get();
   }
   
   bool Logger::isTraceEnabled() const
   {
        if (!repository_raw || repository_raw->isDisabled(Level::TRACE_INT))
        {
                return false;
        }
           return true;
   }
   ```
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to