Skip to content

Instantly share code, notes, and snippets.

@alecthomas
Created July 31, 2013 17:53
Show Gist options
  • Save alecthomas/6124383 to your computer and use it in GitHub Desktop.
Save alecthomas/6124383 to your computer and use it in GitHub Desktop.
FINE, FINER and FINEST logging for Python
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