Commit 77929ad3 authored by Ralf's avatar Ralf
Browse files

log less when in production

parent 55d52a0b
......@@ -7,7 +7,7 @@ from config import mailAddress, mailSender, mailServer
# Logging configuration
syslogLevel = logging.INFO
mailLevel = logging.CRITICAL # must be "larger" than syslog level!
printLevel = logging.DEBUG
printLevel = logging.INFO
# Mail logging handler
def sendeMail(subject, text, receivers, sender=mailSender, replyTo=None):
......@@ -38,7 +38,7 @@ class Logger:
thestr = "%s[%d]: %s" % ("tuerd", os.getpid(), what)
# console log
if lvl >= printLevel:
print(thestr)
print(what)
# syslog
if lvl >= syslogLevel:
self.syslog.log(lvl, thestr)
......
......@@ -319,8 +319,9 @@ class StateMachine():
if not pins.space_active:
logger.info("StateMachine: space switch turned off - starting leaving procedure")
return StateMachine.StateAboutToLeave(self.state_machine)
if not pins.door_closed and self.old_pins().door_closed and random.random() <= HELLO_PROBABILITY:
play_sound("hello")
if not pins.door_closed and self.old_pins().door_closed:
if random.random() <= HELLO_PROBABILITY:
play_sound("hello")
return super().handle_pins_event()
def on_leave(self):
self.api().set_state(False)
......
......@@ -15,8 +15,9 @@ parser.add_argument("-f", "--fallback",
args = parser.parse_args()
if args.debug:
import libtuer
import libtuer, logging
libtuer.mailAddress = []
libtuer.printLevel = logging.DEBUG
if args.fallback:
logger.info("Starting in fallback mode")
else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment