Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Trevor Cappallo
OperationalLogging
Commits
5f6eb309
Commit
5f6eb309
authored
Aug 27, 2015
by
Trevor Cappallo
Browse files
improve email subject
parent
01c315c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
lib/OperationalLogger.py
lib/OperationalLogger.py
+4
-1
No files found.
lib/OperationalLogger.py
View file @
5f6eb309
...
...
@@ -142,14 +142,17 @@ class OperationalLogger:
if
from_address
is
None
:
from_address
=
self
.
__from_address
logging
.
info
(
"Sending log email to %s"
,
addresses
)
subject_prefix
=
"ERROR"
if
level
==
logging
.
CRITICAL
:
buf
=
self
.
__critical_buffer
.
getvalue
()
subject_prefix
=
"CRITICAL"
elif
level
==
logging
.
DEBUG
:
buf
=
self
.
__debug_buffer
.
getvalue
()
subject_prefix
=
"debug"
else
:
buf
=
self
.
__error_buffer
.
getvalue
()
message
=
"<br />
\n
"
.
join
([
self
.
__class__
.
__colorize
(
line
)
for
line
in
buf
.
split
(
'
\n
'
)])
OperationalMail
.
send_status
(
subject
=
'
Errors detected {}:{}'
.
format
(
self
.
__server_name
,
OperationalMail
.
send_status
(
subject
=
'
[{}] Log for {}:{}'
.
format
(
subject_prefix
,
self
.
__server_name
,
os
.
path
.
basename
(
sys
.
argv
[
0
])),
message
=
message
,
to_list
=
addresses
,
from_address
=
from_address
,
text_attachment
=
self
.
__debug_buffer
.
getvalue
())
...
...
Write
Preview
Markdown
is supported
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