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
Cecylia Bocovich
gettor
Commits
3670e782
Commit
3670e782
authored
Apr 29, 2020
by
Cecylia Bocovich
Browse files
Change levels at which service messages are logged
A lot of these are debug messages and don't need to be logged by default.
parent
b8d228ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
gettor/services/email/sendmail.py
View file @
3670e782
...
...
@@ -57,13 +57,13 @@ class Sendmail(object):
:param message (string): Success details from the server.
"""
log
.
info
(
"Email sent successfully."
)
log
.
debug
(
"Email sent successfully."
)
def
sendmail_errback
(
self
,
error
):
"""
Errback if we don't/can't send the message.
"""
log
.
debug
(
"Could not send email."
)
log
.
warn
(
"Could not send email."
)
raise
error
def
sendmail
(
self
,
email_addr
,
subject
,
body
):
...
...
@@ -198,7 +198,7 @@ class Sendmail(object):
subject_msg
=
strings
.
_
(
"help_subject"
)
elif
command
==
"links"
:
log
.
info
(
"Getting links for {} {}."
.
format
(
platform
,
language
))
log
.
debug
(
"Getting links for {} {}."
.
format
(
platform
,
language
))
links
=
yield
self
.
conn
.
get_links
(
platform
=
platform
,
language
=
language
,
status
=
"ACTIVE"
)
...
...
@@ -208,12 +208,12 @@ class Sendmail(object):
body_msg
=
self
.
build_body_message
(
link_msg
,
platform
,
file
)
subject_msg
=
strings
.
_
(
"links_subject"
)
else
:
log
.
info
(
"Invalid gettor command {}."
.
format
(
command
))
log
.
warn
(
"Invalid gettor command {}."
.
format
(
command
))
yield
self
.
conn
.
remove_request
(
id
=
id
,
service
=
"email"
,
date
=
date
)
log
.
info
(
"Sending {} message."
.
format
(
request
[
1
]))
log
.
debug
(
"Sending {} message."
.
format
(
request
[
1
]))
yield
self
.
sendmail
(
email_addr
=
id
,
...
...
@@ -235,7 +235,7 @@ class Sendmail(object):
yield
self
.
conn
.
remove_request
(
id
=
id
,
service
=
"email"
,
date
=
date
)
log
.
info
(
"Error sending email: {}."
.
format
(
e
))
log
.
error
(
"Error sending email: {}."
.
format
(
e
))
except
Exception
as
e
:
log
.
error
(
"Error sending email: {}."
.
format
(
e
))
gettor/services/twitter/twitterdm.py
View file @
3670e782
...
...
@@ -59,14 +59,14 @@ class Twitterdm(object):
:param message (string): Success details from the server.
"""
log
.
info
(
"Message sent successfully."
)
log
.
debug
(
"Message sent successfully."
)
def
twitter_errback
(
self
,
error
):
"""
Errback if we don't/can't send the message.
"""
log
.
debug
(
"Could not send message."
)
log
.
warn
(
"Could not send message."
)
raise
RuntimeError
(
"{}"
.
format
(
error
))
...
...
@@ -131,7 +131,7 @@ class Twitterdm(object):
if
help_requests
:
strings
.
load_strings
(
"en"
)
try
:
log
.
info
(
"Got new help request."
)
log
.
debug
(
"Got new help request."
)
for
request
in
help_requests
:
ids
=
json
.
loads
(
"{}"
.
format
(
request
[
0
].
replace
(
"'"
,
'"'
)))
...
...
@@ -140,7 +140,7 @@ class Twitterdm(object):
date
=
request
[
5
]
hid
=
hashlib
.
sha256
(
twitter_id
.
encode
(
'utf-8'
))
log
.
info
(
log
.
debug
(
"Sending help message to {}."
.
format
(
hid
.
hexdigest
()
)
...
...
@@ -166,11 +166,11 @@ class Twitterdm(object):
)
except
RuntimeError
as
e
:
log
.
info
(
"Error sending twitter message: {}."
.
format
(
e
))
log
.
error
(
"Error sending twitter message: {}."
.
format
(
e
))
elif
link_requests
:
try
:
log
.
info
(
"Got new links request."
)
log
.
debug
(
"Got new links request."
)
for
request
in
link_requests
:
ids
=
json
.
loads
(
"{}"
.
format
(
request
[
0
].
replace
(
"'"
,
'"'
)))
...
...
@@ -188,7 +188,7 @@ class Twitterdm(object):
strings
.
load_strings
(
language
)
locale
=
locales
[
language
][
'locale'
]
log
.
info
(
"Getting links for {}."
.
format
(
platform
))
log
.
debug
(
"Getting links for {}."
.
format
(
platform
))
links
=
yield
self
.
conn
.
get_links
(
platform
=
platform
,
language
=
locale
,
status
=
"ACTIVE"
)
...
...
@@ -225,7 +225,7 @@ class Twitterdm(object):
body_msg
+=
trings
.
_
(
"links_body_ending"
)
hid
=
hashlib
.
sha256
(
twitter_id
.
encode
(
'utf-8'
))
log
.
info
(
log
.
debug
(
"Sending links to {}."
.
format
(
hid
.
hexdigest
()
)
...
...
@@ -247,6 +247,6 @@ class Twitterdm(object):
)
except
RuntimeError
as
e
:
log
.
info
(
"Error sending message: {}."
.
format
(
e
))
log
.
error
(
"Error sending message: {}."
.
format
(
e
))
else
:
log
.
debug
(
"No pending twitter requests. Keep waiting."
)
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