Adaption to default logging method
This commit is contained in:
parent
4bf2a632ed
commit
32d27effcf
@ -1,22 +1,22 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
import os
|
import os
|
||||||
import report
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
DEBUG = False
|
||||||
|
#
|
||||||
|
# Logging
|
||||||
|
#
|
||||||
|
APP_NAME = "mpd"
|
||||||
|
LOG_HOSTNAME = "loggy" # When DEBUG is True
|
||||||
|
LOG_LEVEL = logging.INFO # STDOUT logging
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Application
|
||||||
|
#
|
||||||
MQTT_SERVER = "{{ audio_mpd_hostname }}"
|
MQTT_SERVER = "{{ audio_mpd_hostname }}"
|
||||||
MQTT_USER = "{{ audio_mpd_username }}"
|
MQTT_USER = "{{ audio_mpd_username }}"
|
||||||
MQTT_PASS = "{{ audio_mpd_password }}"
|
MQTT_PASS = "{{ audio_mpd_password }}"
|
||||||
MQTT_TOPIC = "{{ audio_mpd_topic }}"
|
MQTT_TOPIC = "{{ audio_mpd_topic }}"
|
||||||
|
|
||||||
#
|
|
||||||
# Logging
|
|
||||||
#
|
|
||||||
__BASEPATH__ = os.path.abspath(os.path.dirname(__file__))
|
|
||||||
APP_NAME = "mpd"
|
|
||||||
LOGTARGET = 'stdout' # possible choices are: 'logfile' or 'stdout'
|
|
||||||
LOGLVL = 'INFO'
|
|
||||||
|
|
||||||
LOGHOST = 'cutelog'
|
|
||||||
LOGPORT = 19996
|
|
||||||
|
|
||||||
formatter = report.SHORT_FMT
|
|
||||||
|
2
report
2
report
@ -1 +1 @@
|
|||||||
Subproject commit 21bac82e0c459ebf6d34783c9249526a657a6bbd
|
Subproject commit 60be78310ee6b6a5a091f27f9e5e514927d7520f
|
11
smart_mpd.py
11
smart_mpd.py
@ -1,18 +1,11 @@
|
|||||||
import config
|
import config
|
||||||
import logging
|
|
||||||
import mqtt
|
import mqtt
|
||||||
import report
|
import report
|
||||||
import socket
|
|
||||||
import subprocess
|
import subprocess
|
||||||
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('librespot')
|
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
@ -65,7 +58,5 @@ def send_title_msg_mqtt(title):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
report.appLoggingConfigure(config.__BASEPATH__, config.LOGTARGET, ((config.APP_NAME, config.LOGLVL), ), fmt=config.formatter, host=config.LOGHOST, port=config.LOGPORT)
|
|
||||||
|
|
||||||
mpd = mpc(send_state_msg_mqtt, send_title_msg_mqtt)
|
mpd = mpc(send_state_msg_mqtt, send_title_msg_mqtt)
|
||||||
mpd.run()
|
mpd.run()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user