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
|
|
|
|
|
2013-11-09 12:33:52 -05:00
|
|
|
# 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'
|
|
|
|
},
|
2013-11-09 12:33:52 -05:00
|
|
|
'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',
|
2013-11-09 12:33:52 -05:00
|
|
|
'filename': _log_file_name,
|
2013-07-11 20:45:09 -04:00
|
|
|
},
|
2013-11-09 12:33:52 -05:00
|
|
|
'syslog': {
|
|
|
|
'level': 'INFO',
|
|
|
|
'class': 'logging.handlers.SysLogHandler',
|
|
|
|
'formatter': 'verbose',
|
|
|
|
}
|
2013-07-11 20:45:09 -04:00
|
|
|
},
|
|
|
|
'loggers': {
|
2013-11-09 12:33:52 -05:00
|
|
|
'dmrlink': {
|
2013-12-05 19:46:54 -05:00
|
|
|
# 'handlers': ['file-timed', 'syslog'],
|
|
|
|
'handlers': ['console'],
|
2013-07-30 11:52:10 -04:00
|
|
|
'level': 'INFO',
|
2013-07-11 20:45:09 -04:00
|
|
|
'propagate': True,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2013-11-09 12:33:52 -05:00
|
|
|
logger = logging.getLogger('dmrlink')
|