@@ -84,7 +84,19 @@ class LogDroppedAttributesWarning(UserWarning):
8484warnings .simplefilter ("once" , LogDroppedAttributesWarning )
8585
8686
87- class LogDeprecatedInitWarning (UserWarning ):
87+ class LogLimitsInitDeprecatedWarning (UserWarning ):
88+ """Custom warning to indicate deprecated LogLimits init was used.
89+
90+ This class is used to filter and handle these specific warnings separately
91+ from other warnings, ensuring that they are only shown once without
92+ interfering with default user warnings.
93+ """
94+
95+
96+ warnings .simplefilter ("once" , LogLimitsInitDeprecatedWarning )
97+
98+
99+ class LogRecordInitDeprecatedWarning (UserWarning ):
88100 """Custom warning to indicate deprecated LogRecord init was used.
89101
90102 This class is used to filter and handle these specific warnings separately
@@ -93,7 +105,55 @@ class LogDeprecatedInitWarning(UserWarning):
93105 """
94106
95107
96- warnings .simplefilter ("once" , LogDeprecatedInitWarning )
108+ warnings .simplefilter ("once" , LogRecordInitDeprecatedWarning )
109+
110+
111+ class LogDataInitDeprecatedWarning (UserWarning ):
112+ """Custom warning to indicate deprecated LogData init was used.
113+
114+ This class is used to filter and handle these specific warnings separately
115+ from other warnings, ensuring that they are only shown once without
116+ interfering with default user warnings.
117+ """
118+
119+
120+ warnings .simplefilter ("once" , LogDataInitDeprecatedWarning )
121+
122+
123+ class LogRecordContextDeprecatedWarning (UserWarning ):
124+ """Custom warning to indicate LogRecord was initialized without using context.
125+
126+ This class is used to filter and handle these specific warnings separately
127+ from other warnings, ensuring that they are only shown once without
128+ interfering with default user warnings.
129+ """
130+
131+
132+ warnings .simplefilter ("once" , LogRecordContextDeprecatedWarning )
133+
134+
135+ class InMemoryLogExporterDeprecatedWarning (UserWarning ):
136+ """Custom warning to indicate InMemoryLogExporter is deprecated.
137+
138+ This class is used to filter and handle these specific warnings separately
139+ from other warnings, ensuring that they are only shown once without
140+ interfering with default user warnings.
141+ """
142+
143+
144+ warnings .simplefilter ("once" , LogRecordContextDeprecatedWarning )
145+
146+
147+ class ConsoleLogExporterDeprecatedWarning (UserWarning ):
148+ """Custom warning to indicate ConsoleLogExporter is deprecated.
149+
150+ This class is used to filter and handle these specific warnings separately
151+ from other warnings, ensuring that they are only shown once without
152+ interfering with default user warnings.
153+ """
154+
155+
156+ warnings .simplefilter ("once" , ConsoleLogExporterDeprecatedWarning )
97157
98158
99159class LogLimits :
@@ -149,7 +209,7 @@ def __init__(
149209
150210 warnings .warn (
151211 "LogLimits will be deprecated in 1.39.0 and then renamed to LogRecordLimits" ,
152- LogDeprecatedInitWarning ,
212+ LogLimitsInitDeprecatedWarning ,
153213 stacklevel = 0 ,
154214 )
155215
@@ -242,7 +302,7 @@ def __init__( # pylint:disable=too-many-locals
242302 ):
243303 warnings .warn (
244304 "LogRecord will be substituted in 1.39.0 by ReadWriteLogRecord and ReadableLogRecord" ,
245- LogDeprecatedInitWarning ,
305+ LogRecordInitDeprecatedWarning ,
246306 stacklevel = 0 ,
247307 )
248308 if not context :
@@ -251,7 +311,7 @@ def __init__( # pylint:disable=too-many-locals
251311 if trace_id or span_id or trace_flags :
252312 warnings .warn (
253313 "LogRecord init with `trace_id`, `span_id`, and/or `trace_flags` is deprecated since 1.35.0. Use `context` instead." ,
254- LogDeprecatedInitWarning ,
314+ LogRecordContextDeprecatedWarning ,
255315 stacklevel = 2 ,
256316 )
257317
@@ -371,7 +431,7 @@ def __init__(
371431 ):
372432 warnings .warn (
373433 "LogData will be substituted in 1.39.0 by ReadWriteLogRecord and ReadableLogRecord" ,
374- LogDeprecatedInitWarning ,
434+ LogDataInitDeprecatedWarning ,
375435 stacklevel = 0 ,
376436 )
377437 self .log_record = log_record
0 commit comments