Skip to content
Browse files

Added log formatting to include date and time

  • Loading branch information...
1 parent 06848d8 commit e2479d6fd54df85d223f8d2421b9e43b1d34bb89 @kylegordon committed Oct 28, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 mqtt-republisher.py
View
6 mqtt-republisher.py
@@ -30,10 +30,12 @@
client_id = "Republisher_%d" % os.getpid()
mqttc = mosquitto.Mosquitto(client_id)
+LOGFORMAT = '%(asctime)-15s %(message)s'
+
if DEBUG:
- logging.basicConfig(filename=LOGFILE, level=logging.DEBUG)
+ logging.basicConfig(filename=LOGFILE, level=logging.DEBUG, format=LOGFORMAT)
else:
- logging.basicConfig(filename=LOGFILE, level=logging.INFO)
+ logging.basicConfig(filename=LOGFILE, level=logging.INFO, format=LOGFORMAT)
logging.info("Starting mqtt-republisher")
logging.info("INFO MODE")

0 comments on commit e2479d6

Please sign in to comment.
Something went wrong with that request. Please try again.