11
11
import warnings
12
12
from abc import ABC , abstractmethod
13
13
from contextlib import contextmanager
14
- from dataclasses import asdict , dataclass
14
+ from dataclasses import dataclass
15
15
from datetime import datetime , timedelta , timezone
16
16
from enum import Enum , IntEnum
17
17
from functools import partial
@@ -1213,10 +1213,6 @@ class LoggerAdapter(logging.LoggerAdapter):
1213
1213
dictionary value will be added to the ``extra`` dictionary with some
1214
1214
workflow info, making it present on the ``LogRecord.__dict__`` for
1215
1215
use by others. Default is True.
1216
- update_info_on_extra: Boolean for whether a ``temporal_update``
1217
- dictionary value will be added to the ``extra`` dictionary with some
1218
- update info, making it present on the ``LogRecord.__dict__`` for use
1219
- by others. Default is True.
1220
1216
full_workflow_info_on_extra: Boolean for whether a ``workflow_info``
1221
1217
value will be added to the ``extra`` dictionary with the entire
1222
1218
workflow info, making it present on the ``LogRecord.__dict__`` for
@@ -1236,7 +1232,6 @@ def __init__(
1236
1232
super ().__init__ (logger , extra or {})
1237
1233
self .workflow_info_on_message = True
1238
1234
self .workflow_info_on_extra = True
1239
- self .update_info_on_extra = True
1240
1235
self .full_workflow_info_on_extra = False
1241
1236
self .log_during_replay = False
1242
1237
@@ -1247,25 +1242,26 @@ def process(
1247
1242
if (
1248
1243
self .workflow_info_on_message
1249
1244
or self .workflow_info_on_extra
1250
- or self .update_info_on_extra
1251
1245
or self .full_workflow_info_on_extra
1252
1246
):
1253
1247
extra : Dict [str , Any ] = {}
1254
1248
msg_extra : Dict [str , Any ] = {}
1255
1249
runtime = _Runtime .maybe_current ()
1256
1250
if runtime :
1251
+ workflow_details = runtime .logger_details
1257
1252
if self .workflow_info_on_message :
1258
- msg_extra .update (runtime . logger_details )
1253
+ msg_extra .update (workflow_details )
1259
1254
if self .workflow_info_on_extra :
1260
- extra ["temporal_workflow" ] = runtime . logger_details
1255
+ extra ["temporal_workflow" ] = workflow_details
1261
1256
if self .full_workflow_info_on_extra :
1262
1257
extra ["workflow_info" ] = runtime .workflow_info ()
1263
1258
update_info = current_update_info ()
1264
1259
if update_info :
1265
- if self .update_info_on_extra :
1266
- extra ["temporal_update" ] = asdict (update_info )
1260
+ update_details = update_info .logger_details
1267
1261
if self .workflow_info_on_message :
1268
- msg_extra .update (update_info .logger_details )
1262
+ msg_extra .update (update_details )
1263
+ if self .workflow_info_on_extra :
1264
+ extra .setdefault ("temporal_workflow" , {}).update (update_details )
1269
1265
1270
1266
kwargs ["extra" ] = {** extra , ** (kwargs .get ("extra" ) or {})}
1271
1267
if msg_extra :
0 commit comments