File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
microbootstrap/instruments Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -150,10 +150,14 @@ def bootstrap(self) -> None:
150
150
for unset_handlers_logger in self .instrument_config .logging_unset_handlers :
151
151
logging .getLogger (unset_handlers_logger ).handlers = []
152
152
153
+ stream_handler : typing .Final = logging .StreamHandler ()
154
+ root_logger : typing .Final = logging .getLogger ()
155
+ * foreign_pre_chain , renderer = structlog .get_config ()["processors" ]
153
156
structlog .configure (
154
157
processors = [
155
158
* DEFAULT_STRUCTLOG_PROCESSORS ,
156
159
* self .instrument_config .logging_extra_processors ,
160
+ * foreign_pre_chain ,
157
161
DEFAULT_STRUCTLOG_FORMATTER_PROCESSOR ,
158
162
],
159
163
context_class = dict ,
@@ -165,6 +169,17 @@ def bootstrap(self) -> None:
165
169
wrapper_class = structlog .stdlib .BoundLogger ,
166
170
cache_logger_on_first_use = True ,
167
171
)
172
+ stream_handler .setFormatter (
173
+ structlog .stdlib .ProcessorFormatter (
174
+ foreign_pre_chain = [
175
+ * foreign_pre_chain ,
176
+ structlog .stdlib .ProcessorFormatter .remove_processors_meta ,
177
+ ],
178
+ processors = [renderer ],
179
+ logger = root_logger ,
180
+ )
181
+ )
182
+ root_logger .addHandler (stream_handler )
168
183
169
184
@classmethod
170
185
def get_config_type (cls ) -> type [LoggingConfig ]:
You can’t perform that action at this time.
0 commit comments