@@ -88,9 +88,9 @@ class LogLimits:
88
88
UNSET = - 1
89
89
90
90
def __init__ (
91
- self ,
92
- max_attributes : Optional [int ] = None ,
93
- max_attribute_length : Optional [int ] = None ,
91
+ self ,
92
+ max_attributes : Optional [int ] = None ,
93
+ max_attribute_length : Optional [int ] = None ,
94
94
):
95
95
96
96
# attribute count
@@ -114,7 +114,7 @@ def __repr__(self):
114
114
115
115
@classmethod
116
116
def _from_env_if_absent (
117
- cls , value : Optional [int ], env_var : str , default : Optional [int ] = None
117
+ cls , value : Optional [int ], env_var : str , default : Optional [int ] = None
118
118
) -> Optional [int ]:
119
119
if value == cls .UNSET :
120
120
return None
@@ -156,18 +156,18 @@ class LogRecord(APILogRecord):
156
156
"""
157
157
158
158
def __init__ (
159
- self ,
160
- timestamp : Optional [int ] = None ,
161
- observed_timestamp : Optional [int ] = None ,
162
- trace_id : Optional [int ] = None ,
163
- span_id : Optional [int ] = None ,
164
- trace_flags : Optional [TraceFlags ] = None ,
165
- severity_text : Optional [str ] = None ,
166
- severity_number : Optional [SeverityNumber ] = None ,
167
- body : Optional [Any ] = None ,
168
- resource : Optional [Resource ] = None ,
169
- attributes : Optional [Attributes ] = None ,
170
- limits : Optional [LogLimits ] = _UnsetLogLimits ,
159
+ self ,
160
+ timestamp : Optional [int ] = None ,
161
+ observed_timestamp : Optional [int ] = None ,
162
+ trace_id : Optional [int ] = None ,
163
+ span_id : Optional [int ] = None ,
164
+ trace_flags : Optional [TraceFlags ] = None ,
165
+ severity_text : Optional [str ] = None ,
166
+ severity_number : Optional [SeverityNumber ] = None ,
167
+ body : Optional [Any ] = None ,
168
+ resource : Optional [Resource ] = None ,
169
+ attributes : Optional [Attributes ] = None ,
170
+ limits : Optional [LogLimits ] = _UnsetLogLimits ,
171
171
):
172
172
super ().__init__ (
173
173
** {
@@ -229,9 +229,9 @@ class LogData:
229
229
"""Readable LogRecord data plus associated InstrumentationLibrary."""
230
230
231
231
def __init__ (
232
- self ,
233
- log_record : LogRecord ,
234
- instrumentation_scope : InstrumentationScope ,
232
+ self ,
233
+ log_record : LogRecord ,
234
+ instrumentation_scope : InstrumentationScope ,
235
235
):
236
236
self .log_record = log_record
237
237
self .instrumentation_scope = instrumentation_scope
@@ -284,7 +284,7 @@ def __init__(self):
284
284
self ._lock = threading .Lock ()
285
285
286
286
def add_log_record_processor (
287
- self , log_record_processor : LogRecordProcessor
287
+ self , log_record_processor : LogRecordProcessor
288
288
) -> None :
289
289
"""Adds a Logprocessor to the list of log processors handled by this instance"""
290
290
with self ._lock :
@@ -346,16 +346,16 @@ def __init__(self, max_workers: int = 2):
346
346
)
347
347
348
348
def add_log_record_processor (
349
- self , log_record_processor : LogRecordProcessor
349
+ self , log_record_processor : LogRecordProcessor
350
350
):
351
351
with self ._lock :
352
352
self ._log_record_processors += (log_record_processor ,)
353
353
354
354
def _submit_and_wait (
355
- self ,
356
- func : Callable [[LogRecordProcessor ], Callable [..., None ]],
357
- * args : Any ,
358
- ** kwargs : Any ,
355
+ self ,
356
+ func : Callable [[LogRecordProcessor ], Callable [..., None ]],
357
+ * args : Any ,
358
+ ** kwargs : Any ,
359
359
):
360
360
futures = []
361
361
for lp in self ._log_record_processors :
@@ -437,9 +437,9 @@ class LoggingHandler(logging.Handler):
437
437
"""
438
438
439
439
def __init__ (
440
- self ,
441
- level = logging .NOTSET ,
442
- logger_provider = None ,
440
+ self ,
441
+ level = logging .NOTSET ,
442
+ logger_provider = None ,
443
443
) -> None :
444
444
super ().__init__ (level = level )
445
445
self ._logger_provider = logger_provider or get_logger_provider ()
@@ -509,13 +509,13 @@ def flush(self) -> None:
509
509
510
510
class Logger (APILogger ):
511
511
def __init__ (
512
- self ,
513
- resource : Resource ,
514
- multi_log_record_processor : Union [
515
- SynchronousMultiLogRecordProcessor ,
516
- ConcurrentMultiLogRecordProcessor ,
517
- ],
518
- instrumentation_scope : InstrumentationScope ,
512
+ self ,
513
+ resource : Resource ,
514
+ multi_log_record_processor : Union [
515
+ SynchronousMultiLogRecordProcessor ,
516
+ ConcurrentMultiLogRecordProcessor ,
517
+ ],
518
+ instrumentation_scope : InstrumentationScope ,
519
519
):
520
520
super ().__init__ (
521
521
instrumentation_scope .name ,
@@ -540,17 +540,17 @@ def emit(self, record: LogRecord):
540
540
541
541
class LoggerProvider (APILoggerProvider ):
542
542
def __init__ (
543
- self ,
544
- resource : Resource = Resource .create (),
545
- shutdown_on_exit : bool = True ,
546
- multi_log_record_processor : Union [
547
- SynchronousMultiLogRecordProcessor ,
548
- ConcurrentMultiLogRecordProcessor ,
549
- ] = None ,
543
+ self ,
544
+ resource : Resource = Resource .create (),
545
+ shutdown_on_exit : bool = True ,
546
+ multi_log_record_processor : Union [
547
+ SynchronousMultiLogRecordProcessor ,
548
+ ConcurrentMultiLogRecordProcessor ,
549
+ ] = None ,
550
550
):
551
551
self ._resource = resource
552
552
self ._multi_log_record_processor = (
553
- multi_log_record_processor or SynchronousMultiLogRecordProcessor ()
553
+ multi_log_record_processor or SynchronousMultiLogRecordProcessor ()
554
554
)
555
555
self ._at_exit_handler = None
556
556
if shutdown_on_exit :
@@ -561,10 +561,10 @@ def resource(self):
561
561
return self ._resource
562
562
563
563
def get_logger (
564
- self ,
565
- name : str ,
566
- version : Optional [str ] = None ,
567
- schema_url : Optional [str ] = None ,
564
+ self ,
565
+ name : str ,
566
+ version : Optional [str ] = None ,
567
+ schema_url : Optional [str ] = None ,
568
568
) -> Logger :
569
569
return Logger (
570
570
self ._resource ,
@@ -577,7 +577,7 @@ def get_logger(
577
577
)
578
578
579
579
def add_log_record_processor (
580
- self , log_record_processor : LogRecordProcessor
580
+ self , log_record_processor : LogRecordProcessor
581
581
):
582
582
"""Registers a new :class:`LogRecordProcessor` for this `LoggerProvider` instance.
583
583
0 commit comments