Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mailman-lmtp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ai3
thirdparty
mailman-lmtp
Commits
ff34a915
Commit
ff34a915
authored
6 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Send all logs to syslog
With facility=MAIL.
parent
f7b7356d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Mailman/Logging/Syslog.py
+24
-3
24 additions, 3 deletions
Mailman/Logging/Syslog.py
with
24 additions
and
3 deletions
Mailman/Logging/Syslog.py
+
24
−
3
View file @
ff34a915
...
...
@@ -21,8 +21,7 @@ This might eventually be replaced by a syslog based logger, hence the name.
"""
import
quopri
from
Mailman.Logging.StampedLogger
import
StampedLogger
import
syslog
as
real_syslog
...
...
@@ -30,6 +29,28 @@ from Mailman.Logging.StampedLogger import StampedLogger
syslog
=
None
# Our syslog-writing class
_syslog_initialized
=
False
class
_SyslogLogger
(
Logger
):
def
__init__
(
self
,
kind
):
global
_syslog_initialized
if
not
_syslog_initialized
:
real_syslog
.
openlog
(
identity
=
'
mailman
'
,
facility
=
real_syslog
.
LOG_MAIL
)
_syslog_initialized
=
True
self
.
_priority
=
real_syslog
.
LOG_INFO
if
kind
==
'
error
'
or
kind
==
'
smtp-failure
'
:
self
.
_priority
=
real_syslog
.
LOG_ERROR
def
write
(
self
,
msg
):
real_syslog
.
syslog
(
self
.
_priority
,
msg
)
def
close
(
self
):
pass
# Don't instantiate except below.
class
_Syslog
:
...
...
@@ -49,7 +70,7 @@ class _Syslog:
origmsg
=
msg
logf
=
self
.
_logfiles
.
get
(
kind
)
if
not
logf
:
logf
=
self
.
_logfiles
[
kind
]
=
Stamped
Logger
(
kind
)
logf
=
self
.
_logfiles
[
kind
]
=
_Syslog
Logger
(
kind
)
try
:
if
args
:
msg
%=
args
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment