modified the logging to comply with what is on the docs.python.org page on the logging library and how it should be used

This commit is contained in:
sm
2011-03-22 11:10:19 -06:00
parent 2c07c3ba45
commit 05d1b962fc
5 changed files with 25 additions and 32 deletions
+18
View File
@@ -0,0 +1,18 @@
import logging
import logging.handlers
config = {
'filename': '/tmp/interpolatoryawesome.log',
'level': logging.DEBUG,
'size' : 1024000,
'backupCount': 10,
}
logger = logging.getLogger('interp')
logger.setLevel(config['level'])
my_format = logging.Formatter('%(asctime)s %(levelname)s (%(process)d) %(filename)s %(funcName)s:%(lineno)d %(message)s')
handler = logging.handlers.RotatingFileHandler(
config['filename'], maxBytes = config['size'] * 1024, backupCount = config['backupCount'])
handler.setFormatter(my_format)
logger.addHandler(handler)