@@ -102,31 +102,35 @@ The Google Cloud Logging library attempts to detect and attach additional
102
102
The following fields are currently supported:
103
103
104
104
- labels
105
- - trace*
106
- - span_id*
107
- - trace_sampled*
108
- - http_request*
105
+ - trace
106
+ - span_id
107
+ - trace_sampled
108
+ - http_request
109
109
- source_location
110
110
- resource
111
111
- :ref: `json_fields<JSON> `
112
112
113
113
.. note ::
114
- Fields marked with "*" require a :doc: `supported Python web framework </web-framework-integration >`.
114
+ | More information about `trace`, `span_id`, and `trace_sampled` can be found :doc:`here </auto-trace-span-extraction>`.
115
+ | `http_request` requires a :doc:`supported Python web framework </web-framework-integration>`.
116
+
115
117
116
118
Manual Metadata Using the `extra ` Argument
117
119
--------------------------------------------
118
120
121
+ .. _Manual-Metadata :
122
+
119
123
The Python :mod: `logging ` standard library accepts `an "extra" argument <https://docs.python.org/3/library/logging.html#logging.Logger.debug >`_ when
120
124
writing logs. You can use this argument to populate LogRecord objects with user-defined
121
125
key-value pairs. Google Cloud Logging uses the `extra ` field as a way to pass in additional
122
- metadata to populate `LogEntry fields < https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry > `_.
126
+ metadata to populate `LogEntry fields `_.
123
127
124
128
.. literalinclude :: ../samples/snippets/usage_guide.py
125
129
:start-after: [START logging_extras]
126
130
:end-before: [END logging_extras]
127
131
:dedent: 4
128
132
129
- All of the `LogEntry fields < https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry > `_
133
+ All of the `LogEntry fields `_
130
134
that can be :ref: `autodetected<Autodetection> ` can also be set manually through the `extra ` argument. Fields sent explicitly through the `extra `
131
135
argument override any :ref: `automatically detected<Autodetection> ` fields.
132
136
@@ -153,3 +157,5 @@ You can use both transport options over :doc:`gRPC or HTTP</grpc-vs-http>`.
153
157
.. note ::
154
158
:class: `~google.cloud.logging_v2.handlers.structured_log.StructuredLogHandler `
155
159
prints logs as formatted JSON to standard output, and does not use a Transport class.
160
+
161
+ .. _LogEntry fields : https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry
0 commit comments