Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladislav Rykov
THSO.server
Commits
155f984b
Commit
155f984b
authored
Jun 30, 2020
by
Vladislav Rykov
Browse files
logger added to notification_manager
parent
afc703fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/app/helpers/notification_manager.py
View file @
155f984b
...
...
@@ -34,18 +34,22 @@ def listening():
# send mail
n
=
nf
.
get
(
d
[
'appkey'
],
d
[
'devid'
],
d
[
'nfid'
])[
1
]
mailer
.
send_mail
(
app
,
n
,
d
)
app
.
logger
.
info
(
'Alert {} was fired.'
)
elif
d
[
'action_type'
]
==
'alert_telegram'
:
# send telegram message
n
=
nf
.
get
(
d
[
'appkey'
],
d
[
'devid'
],
d
[
'nfid'
])[
1
]
ts
.
send_message
(
app
,
n
,
d
)
app
.
logger
.
info
(
'Alert {} was fired.'
)
elif
d
[
'action_type'
]
==
'automation'
:
# enqueue confid
# action format: '<devid>#<confid>#<arg>'
action
=
d
[
'action'
].
split
(
'#'
)
base64_args
=
misc
.
pend_base64_encode
(
action
[
2
],
action
[
1
])
pend
.
create
(
d
[
'appkey'
],
action
[
0
],
base64_args
)
app
.
logger
.
info
(
'Automation for application {} with format {} was fired.'
.
format
(
d
[
'appkey'
],
d
[
'action'
]))
except
Exception
as
e
:
print
(
'Notification manager thread error:'
,
e
)
app
.
logger
.
error
(
'Notification manager thread error: {}'
.
format
(
e
))
logger
.
pass
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment