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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user