diff options
author | Lars Wirzenius <liw@liw.fi> | 2017-10-03 14:53:59 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2017-10-03 14:53:59 +0000 |
commit | 1cbbd722094a214034690599440b3cd62e002e64 (patch) | |
tree | ecb0d3024dd517c30ae955c4c67a93e0d1c77528 /ick_controller.py | |
parent | 8127a0167c2f0fcbc0bcff9e43e58bc3740deb5c (diff) | |
download | ick2-1cbbd722094a214034690599440b3cd62e002e64.tar.gz |
Add: log to syslog until slog is configured
Diffstat (limited to 'ick_controller.py')
-rw-r--r-- | ick_controller.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ick_controller.py b/ick_controller.py index a029145..6868f86 100644 --- a/ick_controller.py +++ b/ick_controller.py @@ -15,6 +15,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. +import logging import os @@ -53,9 +54,16 @@ def load_config(filename, defconf): return actual_config +logger = logging.getLogger() +logger.setLevel(logging.DEBUG) +handler = logging.handler.SysLogHandler(address='/dev/log') +logger.addHandler(handler) + config_filename = os.environ.get('ICK_CONTROLLER_CONFIG') if not config_filename: + logging.error('no ICK_CONTROLLER_CONFIG in environment') raise Exception('No ICK_CONTROLLER_CONFIG defined in environment') + config = load_config(config_filename, default_config) ick2.setup_logging(config) ick2.log.log('info', msg_text='Ick2 controller starts', config=config) |