Adaption to default logging method
This commit is contained in:
parent
377b7aecc1
commit
5046c934ab
@ -1,12 +1,19 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
import os
|
import os
|
||||||
import report
|
import logging
|
||||||
|
|
||||||
from remotes import yamaha_ras5 as amplifier
|
from remotes import yamaha_ras5 as amplifier
|
||||||
from remotes import technics_eur642100 as cd_player
|
from remotes import technics_eur642100 as cd_player
|
||||||
|
|
||||||
__BASEPATH__ = os.path.abspath(os.path.dirname(__file__))
|
|
||||||
|
DEBUG = False
|
||||||
|
#
|
||||||
|
# Logging
|
||||||
|
#
|
||||||
|
APP_NAME = "remote_control"
|
||||||
|
LOG_HOSTNAME = "loggy" # When DEBUG is True
|
||||||
|
LOG_LEVEL = logging.INFO # STDOUT logging
|
||||||
|
|
||||||
MQTT_SERVER = "{{ smart_sat_remotectrl_hostname }}"
|
MQTT_SERVER = "{{ smart_sat_remotectrl_hostname }}"
|
||||||
MQTT_USER = "{{ smart_sat_remotectrl_username }}"
|
MQTT_USER = "{{ smart_sat_remotectrl_username }}"
|
||||||
@ -17,15 +24,3 @@ SUPPORTED_REMOTES = {
|
|||||||
amplifier.NAME: amplifier.ALL,
|
amplifier.NAME: amplifier.ALL,
|
||||||
cd_player.NAME: cd_player.ALL
|
cd_player.NAME: cd_player.ALL
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Logging
|
|
||||||
#
|
|
||||||
APP_NAME = "remote_control"
|
|
||||||
LOGTARGET = 'stdout' # possible choices are: 'logfile' or 'stdout'
|
|
||||||
LOGLVL = 'INFO'
|
|
||||||
|
|
||||||
LOGHOST = 'cutelog'
|
|
||||||
LOGPORT = 19996
|
|
||||||
|
|
||||||
formatter = report.SHORT_FMT
|
|
||||||
|
@ -1,18 +1,12 @@
|
|||||||
import config
|
import config
|
||||||
import json
|
import json
|
||||||
import lirc
|
import lirc
|
||||||
import logging
|
|
||||||
import mqtt
|
import mqtt
|
||||||
import report
|
import report
|
||||||
import socket
|
import socket
|
||||||
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')
|
|
||||||
|
|
||||||
|
|
||||||
class remote_control(mqtt.mqtt_client):
|
class remote_control(mqtt.mqtt_client):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -92,8 +86,6 @@ class remote_control(mqtt.mqtt_client):
|
|||||||
|
|
||||||
|
|
||||||
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)
|
|
||||||
#
|
|
||||||
rc = remote_control()
|
rc = remote_control()
|
||||||
#
|
#
|
||||||
while (True):
|
while (True):
|
||||||
|
2
report
2
report
@ -1 +1 @@
|
|||||||
Subproject commit 21bac82e0c459ebf6d34783c9249526a657a6bbd
|
Subproject commit 60be78310ee6b6a5a091f27f9e5e514927d7520f
|
Loading…
x
Reference in New Issue
Block a user