@@ -33,6 +33,13 @@ pub fn forward_to_tracing(py: Python, record: PyObject) -> PyResult<()> {
33
33
let file = record. getattr ( py, "filename" ) ?;
34
34
let file: & str = file. extract ( py) ?;
35
35
let level: i32 = record. getattr ( py, "levelno" ) ?. extract ( py) ?;
36
+
37
+ // Extract actor_id from the Python record object if available
38
+ let actor_id = record
39
+ . getattr ( py, "actor_id" )
40
+ . ok ( )
41
+ . and_then ( |attr| attr. extract :: < String > ( py) . ok ( ) ) ;
42
+
36
43
// Map level number to level name
37
44
match level {
38
45
40 | 50 => {
@@ -53,21 +60,36 @@ pub fn forward_to_tracing(py: Python, record: PyObject) -> PyResult<()> {
53
60
file = file,
54
61
lineno = lineno,
55
62
stacktrace = traceback,
63
+ actor_id = actor_id. as_deref( ) ,
56
64
message
57
65
) ;
58
66
}
59
67
None => {
60
- tracing:: error!( file = file, lineno = lineno, message) ;
68
+ tracing:: error!(
69
+ file = file,
70
+ lineno = lineno,
71
+ actor_id = actor_id. as_deref( ) ,
72
+ message
73
+ ) ;
61
74
}
62
75
}
63
76
}
64
- 30 => tracing:: warn!( target: "log_events" , file = file, lineno = lineno, message) ,
65
- 20 => tracing:: info!( target: "log_events" , file = file, lineno = lineno, message) ,
66
- 10 => tracing:: debug!( target: "log_events" , file = file, lineno = lineno, message) ,
67
- _ => tracing:: info!( target: "log_events" , file = file, lineno = lineno, message) ,
77
+ 30 => {
78
+ tracing:: warn!( target: "log_events" , file = file, lineno = lineno, actor_id = actor_id. as_deref( ) , message)
79
+ }
80
+ 20 => {
81
+ tracing:: info!( target: "log_events" , file = file, lineno = lineno, actor_id = actor_id. as_deref( ) , message)
82
+ }
83
+ 10 => {
84
+ tracing:: debug!( target: "log_events" , file = file, lineno = lineno, actor_id = actor_id. as_deref( ) , message)
85
+ }
86
+ _ => {
87
+ tracing:: info!( target: "log_events" , file = file, lineno = lineno, actor_id = actor_id. as_deref( ) , message)
88
+ }
68
89
}
69
90
Ok ( ( ) )
70
91
}
92
+
71
93
#[ pyfunction]
72
94
pub fn use_real_clock ( ) -> PyResult < ( ) > {
73
95
swap_telemetry_clock ( ClockKind :: Real ( RealClock ) ) ;
0 commit comments