Permalink
Browse files

Put DEBUG back into config file, and inverted debug logic

  • Loading branch information...
1 parent 167e241 commit e7660c91c087f09eafc1469c3adb81e07f340391 @kylegordon committed Sep 28, 2012
Showing with 4 additions and 4 deletions.
  1. +1 −0 mqtt-republisher.cfg.example
  2. +3 −4 mqtt-republisher.py
View
1 mqtt-republisher.cfg.example
@@ -1,4 +1,5 @@
[global]
+DEBUG = False
LOGFILE = /var/log/mqtt-republisher.log
MAPFILE = /etc/mqtt-republisher/map.csv
MQTT_HOST = 10.8.0.1
View
7 mqtt-republisher.py
@@ -15,13 +15,12 @@
import mosquitto
import ConfigParser
-DEBUG = false
-
# Read the config file
config = ConfigParser.RawConfigParser()
config.read("/etc/mqtt-republisher/mqtt-republisher.cfg")
#Use ConfigParser to pick out the settings
+DEBUG = config.getboolean("global", "debug")
LOGFILE = config.get("global", "logfile")
MAPFILE = config.get("global", "mapfile")
MQTT_HOST = config.get("global", "mqtt_host")
@@ -32,9 +31,9 @@
mqttc = mosquitto.Mosquitto(client_id)
if DEBUG:
- logging.basicConfig(filename=LOGFILE, level=logging.INFO)
-else:
logging.basicConfig(filename=LOGFILE, level=logging.DEBUG)
+else:
+ logging.basicConfig(filename=LOGFILE, level=logging.INFO)
logging.info("Starting mqtt-republisher")
logging.info("INFO MODE")

0 comments on commit e7660c9

Please sign in to comment.