You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,14 @@ if not converted:
60
60
logger.critical("This is not supposed to happen", converted=converted)
61
61
```
62
62
63
+
The `structlog_gcp.build_processors()` function constructs structlog processors to:
64
+
65
+
* Output logs as Google Cloud Logging format using the default Python JSON serializer.
66
+
* Carry context variables across loggers (see [structlog: Context Variables](https://www.structlog.org/en/stable/contextvars.html))
67
+
68
+
For more advanced usage, see [Advanced Configuration][#advanced-configuration]
69
+
70
+
63
71
### Errors
64
72
65
73
Errors are automatically reported to the [Google Error Reporting service](https://cloud.google.com/error-reporting/).
@@ -81,6 +89,49 @@ You can configure the service name and the version used during the report with 2
81
89
structlog.configure(processors=processors)
82
90
```
83
91
92
+
### Advanced Configuration
93
+
94
+
If you need to have more control over the processors configured by the library, you can use the `structlog_gcp.build_gcp_processors()` builder function.
95
+
96
+
This function only configures the Google Cloud Logging-specific processors and omits all the rest.
97
+
98
+
In particular, you can use this function:
99
+
100
+
* If you want to have more control over the processors to be configured in structlog. You can prepend or append other processors around the Google-specific ones.
101
+
* If you want to serialize using another JSON serializer or with specific options.
0 commit comments