diff --git a/bt-audioparser/bt-audioparser.py b/bt-audioparser/bt-audioparser.py index 60872d7..f2f8a0e 100644 --- a/bt-audioparser/bt-audioparser.py +++ b/bt-audioparser/bt-audioparser.py @@ -8,11 +8,7 @@ import report import sys import time -try: - from config import APP_NAME as ROOT_LOGGER_NAME -except ImportError: - ROOT_LOGGER_NAME = 'root' -logger = logging.getLogger(ROOT_LOGGER_NAME).getChild('main') +logger = report.default_logging_config() player_state = False current_title = '' @@ -65,8 +61,6 @@ def on_mqtt_ctrl(client, userdata, message): logger.warning("Player control impossible due to no player available.") if __name__ == "__main__": - report.stdoutLoggingConfigure(((config.APP_NAME, config.LOGLVL), ), fmt=config.formatter) - # mc = mqtt.mqtt_client(config.APP_NAME, config.MQTT_SERVER, 1883, config.MQTT_USER, config.MQTT_PASS) mc.add_callback(config.MQTT_TOPIC + '/#', on_mqtt_ctrl) # diff --git a/bt-audioparser/config_example/config.j2 b/bt-audioparser/config_example/config.j2 index 8c55d25..800235e 100644 --- a/bt-audioparser/config_example/config.j2 +++ b/bt-audioparser/config_example/config.j2 @@ -1,22 +1,23 @@ #!/usr/bin/env python # -*- coding: UTF-8 -*- import os -import report +import logging +__BASEPATH__ = os.path.abspath(os.path.dirname(__file__)) + +DEBUG = False +# +# Logging +# +APP_NAME = "bt-audioparser" +LOG_HOSTNAME = "loggy" # When DEBUG is True +LOG_LEVEL = logging.INFO # STDOUT logging + + +# +# Application +# MQTT_USER = "{{ audio_bt_username }}" MQTT_PASS = "{{ audio_bt_password }}" MQTT_SERVER = "{{ audio_bt_hostname }}" MQTT_TOPIC = "{{ audio_bt_topic }}" - -# -# Logging -# -__BASEPATH__ = os.path.abspath(os.path.dirname(__file__)) -APP_NAME = "btaudio" -LOGTARGET = 'stdout' # possible choices are: 'logfile' or 'stdout' -LOGLVL = 'INFO' - -LOGHOST = 'cutelog' -LOGPORT = 19996 - -formatter = report.SHORT_FMT diff --git a/bt-audioparser/report b/bt-audioparser/report index b53dd30..60be783 160000 --- a/bt-audioparser/report +++ b/bt-audioparser/report @@ -1 +1 @@ -Subproject commit b53dd30eae1d679b7eec4999bec50aed55bc105b +Subproject commit 60be78310ee6b6a5a091f27f9e5e514927d7520f