Created
July 31, 2013 17:53
-
-
Save alecthomas/6124383 to your computer and use it in GitHub Desktop.
FINE, FINER and FINEST logging for Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logging.FINE = 7 | |
logging.FINER = 5 | |
logging.FINEST = 1 | |
logging.addLevelName(logging.FINE, 'FINE') | |
logging.addLevelName(logging.FINER, 'FINER') | |
logging.addLevelName(logging.FINEST, 'FINEST') | |
logging.Logger.fine = lambda self, *args, **kwargs: self.log(logging.FINE, *args, **kwargs) | |
logging.Logger.finer = lambda self, *args, **kwargs: self.log(logging.FINER, *args, **kwargs) | |
logging.Logger.finest = lambda self, *args, **kwargs: self.log(logging.FINEST, *args, **kwargs) | |
root = logging.getLogger() | |
logging.fine = root.fine | |
logging.finer = root.finer | |
logging.finest = root.finest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment