Skip to content

Commit 64b0292

Browse files
authored
Split out the JSON renderer from the Cloud Logging formatter (#30)
This separates the concern a bit more and allow to configure specific JSON renderer when there's a need to.
1 parent 576d969 commit 64b0292

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

structlog_gcp/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import structlog.processors
12
from structlog.typing import Processor
23

34
from . import errors, processors
@@ -16,5 +17,5 @@ def build_processors(
1617
procs.extend(errors.ReportError(["CRITICAL"]).setup())
1718
procs.extend(errors.ServiceContext(service, version).setup())
1819
procs.extend(processors.FormatAsCloudLogging().setup())
19-
20+
procs.append(structlog.processors.JSONRenderer())
2021
return procs

structlog_gcp/processors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class FormatAsCloudLogging:
4444
"""
4545

4646
def setup(self) -> list[Processor]:
47-
return [self, structlog.processors.JSONRenderer()]
47+
return [self]
4848

4949
def __call__(
5050
self, logger: WrappedLogger, method_name: str, event_dict: EventDict

0 commit comments

Comments
 (0)