DMRlink/ipsc/ipsc_logger.py

72 lines
2.0 KiB
Python
Raw Normal View History

2013-10-29 09:17:50 -04:00
# Copyright (c) 2013 Cortney T. Buffington, N0MJS and the K0USY Group. n0mjs@me.com
2013-08-02 16:31:55 -04:00
#
# This work is licensed under the Creative Commons Attribution-ShareAlike
# 3.0 Unported License.To view a copy of this license, visit
# http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to
# Creative Commons, 444 Castro Street, Suite 900, Mountain View,
# California, 94041, USA.
2013-07-11 20:45:09 -04:00
# Logging system configuration
from logging.config import dictConfig
import logging
# Full path/name of the log file:
_log_file_name = '/tmp/dmrlink.log'
2013-07-11 20:45:09 -04:00
dictConfig({
'version': 1,
'disable_existing_loggers': False,
'filters': {
},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'timed': {
'format': '%(levelname)s %(asctime)s %(message)s'
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
},
'console-timed': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'timed'
},
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'formatter': 'simple',
'filename': _log_file_name,
},
2013-07-11 20:45:09 -04:00
'file-timed': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'formatter': 'timed',
'filename': _log_file_name,
2013-07-11 20:45:09 -04:00
},
'syslog': {
'level': 'INFO',
'class': 'logging.handlers.SysLogHandler',
'formatter': 'verbose',
}
2013-07-11 20:45:09 -04:00
},
'loggers': {
'dmrlink': {
# 'handlers': ['file-timed', 'syslog'],
'handlers': ['console'],
'level': 'INFO',
2013-07-11 20:45:09 -04:00
'propagate': True,
}
}
})
logger = logging.getLogger('dmrlink')