mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-09 17:07:43 +01:00
fix notify on error
This commit is contained in:
parent
9f655c9393
commit
cde20f647d
2 changed files with 16 additions and 15 deletions
|
@ -1,3 +1,3 @@
|
|||
__version__ = "4.0.7.rc2"
|
||||
__version__ = "4.0.7.rc3"
|
||||
__codename__ = "November Rain"
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@ class NotificationController:
|
|||
'''
|
||||
self.cbpi = cbpi
|
||||
self.logger = logging.getLogger(__name__)
|
||||
NOTIFY_ON_ERROR = self.cbpi.config.get("NOTIFY_ON_ERROR", "No")
|
||||
if NOTIFY_ON_ERROR == "Yes":
|
||||
logging.root.addFilter(self.notify_log_event)
|
||||
self.callback_cache = {}
|
||||
self.listener = {}
|
||||
|
||||
def notify_log_event(self, record):
|
||||
NOTIFY_ON_ERROR = self.cbpi.config.get("NOTIFY_ON_ERROR", "No")
|
||||
if NOTIFY_ON_ERROR == "Yes":
|
||||
try:
|
||||
if record.levelno > 20:
|
||||
# on log events higher then INFO we want to notify all clients
|
||||
|
@ -30,6 +30,7 @@ class NotificationController:
|
|||
pass
|
||||
finally:
|
||||
return True
|
||||
return True
|
||||
|
||||
def add_listener(self, method):
|
||||
listener_id = shortuuid.uuid()
|
||||
|
|
Loading…
Reference in a new issue