Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
6
Merge Requests
6
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
slapos.buildout
Commits
638f1985
Commit
638f1985
authored
May 16, 2024
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] Fix logging filters for Python2
parent
35b7a793
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+9
-2
No files found.
src/zc/buildout/buildout.py
View file @
638f1985
...
...
@@ -1284,16 +1284,23 @@ class Buildout(DictMixin):
root_logger
=
logging
.
getLogger
()
self
.
_logger
=
buildout_logger
=
logging
.
getLogger
(
'zc.buildout'
)
# BBB Python2 (Python3 accepts lambdas as filters)
class
Filter
(
object
):
def
__init__
(
self
,
callable
):
self
.
callable
=
callable
def
filter
(
self
,
record
):
return
self
.
callable
(
record
)
# root-specific WARNING handler because setuptools>=65.6.0 logs to root
root_handler
=
logging
.
StreamHandler
(
sys
.
stdout
)
root_handler
.
setLevel
(
logging
.
WARNING
)
root_handler
.
addFilter
(
lambda
record
:
record
.
name
==
'root'
)
root_handler
.
addFilter
(
Filter
(
lambda
record
:
record
.
name
==
'root'
)
)
root_handler
.
setFormatter
(
logging
.
Formatter
(
generic_log_format
))
root_logger
.
addHandler
(
root_handler
)
# generic handler for third-party logs
generic_handler
=
logging
.
StreamHandler
(
sys
.
stdout
)
generic_handler
.
addFilter
(
lambda
record
:
record
.
name
!=
'root'
)
generic_handler
.
addFilter
(
Filter
(
lambda
record
:
record
.
name
!=
'root'
)
)
generic_handler
.
setFormatter
(
logging
.
Formatter
(
generic_log_format
))
root_logger
.
addHandler
(
generic_handler
)
...
...
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