Adaption to default logging method
This commit is contained in:
parent
b9d40378ba
commit
6fa7db9b30
@ -8,11 +8,7 @@ import report
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
try:
|
logger = report.default_logging_config()
|
||||||
from config import APP_NAME as ROOT_LOGGER_NAME
|
|
||||||
except ImportError:
|
|
||||||
ROOT_LOGGER_NAME = 'root'
|
|
||||||
logger = logging.getLogger(ROOT_LOGGER_NAME).getChild('main')
|
|
||||||
|
|
||||||
player_state = False
|
player_state = False
|
||||||
current_title = ''
|
current_title = ''
|
||||||
@ -65,8 +61,6 @@ def on_mqtt_ctrl(client, userdata, message):
|
|||||||
logger.warning("Player control impossible due to no player available.")
|
logger.warning("Player control impossible due to no player available.")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
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 = 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)
|
mc.add_callback(config.MQTT_TOPIC + '/#', on_mqtt_ctrl)
|
||||||
#
|
#
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
import os
|
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_USER = "{{ audio_bt_username }}"
|
||||||
MQTT_PASS = "{{ audio_bt_password }}"
|
MQTT_PASS = "{{ audio_bt_password }}"
|
||||||
MQTT_SERVER = "{{ audio_bt_hostname }}"
|
MQTT_SERVER = "{{ audio_bt_hostname }}"
|
||||||
MQTT_TOPIC = "{{ audio_bt_topic }}"
|
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
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit b53dd30eae1d679b7eec4999bec50aed55bc105b
|
Subproject commit 60be78310ee6b6a5a091f27f9e5e514927d7520f
|
Loading…
x
Reference in New Issue
Block a user