Python logging best practices for reusable modules designed to be included in other code

I am developing a reusable Python module (for Python 2.7, if that matters). I am wondering what is best suited for journaling for others who want to incorporate my module into a larger structure that has its own approach to registration.

Is there a standard way to configure logging in my module to use any logs that the external caller has identified?

+4
source share
1 answer

, , : http://eric.themoritzfamily.com/learning-python-logging.html

, .

  • getLogger __name__ :

     import logging
     logger = logging.getLogger(__name__)
     logger.info( ... )
     logger.debug( ... )
    
  • - , " ", . ( ) .

+6

All Articles