Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
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
Container Registry
Model registry
Monitor
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
Maunium
synapse
Commits
d9bd62f9
Unverified
Commit
d9bd62f9
authored
3 years ago
by
Richard van der Hoff
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Make LoggingContext's name optional (#9857)
Fixes
https://github.com/matrix-org/synapse-s3-storage-provider/issues/55
parent
bdb4c20d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/9857.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/9857.bugfix
synapse/logging/context.py
+12
-3
12 additions, 3 deletions
synapse/logging/context.py
with
13 additions
and
3 deletions
changelog.d/9857.bugfix
0 → 100644
+
1
−
0
View file @
d9bd62f9
Fix a regression in Synapse v1.32.1 which caused `LoggingContext` errors in plugins.
This diff is collapsed.
Click to expand it.
synapse/logging/context.py
+
12
−
3
View file @
d9bd62f9
...
...
@@ -258,7 +258,8 @@ class LoggingContext:
child to the parent
Args:
name (str): Name for the context for debugging.
name: Name for the context for logging. If this is omitted, it is
inherited from the parent context.
parent_context (LoggingContext|None): The parent of the new context
"""
...
...
@@ -277,12 +278,11 @@ class LoggingContext:
def
__init__
(
self
,
name
:
str
,
name
:
Optional
[
str
]
=
None
,
parent_context
:
"
Optional[LoggingContext]
"
=
None
,
request
:
Optional
[
ContextRequest
]
=
None
,
)
->
None
:
self
.
previous_context
=
current_context
()
self
.
name
=
name
# track the resources used by this context so far
self
.
_resource_usage
=
ContextResourceUsage
()
...
...
@@ -314,6 +314,15 @@ class LoggingContext:
# the request param overrides the request from the parent context
self
.
request
=
request
# if we don't have a `name`, but do have a parent context, use its name.
if
self
.
parent_context
and
name
is
None
:
name
=
str
(
self
.
parent_context
)
if
name
is
None
:
raise
ValueError
(
"
LoggingContext must be given either a name or a parent context
"
)
self
.
name
=
name
def
__str__
(
self
)
->
str
:
return
self
.
name
...
...
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