logger-36 2025.8__py3-none-any.whl → 2025.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- logger_36/catalog/handler/console.py +3 -2
- logger_36/catalog/handler/console_rich.py +21 -32
- logger_36/catalog/handler/file.py +3 -3
- logger_36/catalog/handler/generic.py +11 -22
- logger_36/catalog/logger/gpu.py +1 -1
- logger_36/exception.py +2 -3
- logger_36/handler.py +5 -5
- logger_36/type/handler.py +1 -1
- logger_36/type/logger.py +51 -63
- logger_36/version.py +1 -1
- {logger_36-2025.8.dist-info → logger_36-2025.10.dist-info}/METADATA +1 -1
- {logger_36-2025.8.dist-info → logger_36-2025.10.dist-info}/RECORD +14 -14
- {logger_36-2025.8.dist-info → logger_36-2025.10.dist-info}/WHEEL +0 -0
- {logger_36-2025.8.dist-info → logger_36-2025.10.dist-info}/top_level.txt +0 -0
@@ -6,6 +6,7 @@ SEE COPYRIGHT NOTICE BELOW
|
|
6
6
|
|
7
7
|
import dataclasses as d
|
8
8
|
import logging as l
|
9
|
+
import sys as s
|
9
10
|
import typing as h
|
10
11
|
|
11
12
|
from logger_36.constant.record import SHOW_W_RULE_ATTR
|
@@ -58,14 +59,14 @@ class console_handler_t(l.Handler):
|
|
58
59
|
message = RuleAsText(record.msg)
|
59
60
|
else:
|
60
61
|
message = self.MessageFromRecord(record)
|
61
|
-
|
62
|
+
s.__stdout__.write(message + "\n")
|
62
63
|
|
63
64
|
def LogAsIs(self, message: str, /) -> None:
|
64
65
|
"""
|
65
66
|
See documentation of
|
66
67
|
logger_36.catalog.handler.generic.generic_handler_t.LogAsIs.
|
67
68
|
"""
|
68
|
-
|
69
|
+
s.__stdout__.write(message + "\n")
|
69
70
|
|
70
71
|
def DisplayRule(self, /, *, text: str | None = None, color: str = "white") -> None:
|
71
72
|
""""""
|
@@ -48,32 +48,31 @@ class console_rich_handler_t(l.Handler):
|
|
48
48
|
"""
|
49
49
|
kind: See logger_36.constant.handler.handler_codes_h.
|
50
50
|
|
51
|
-
|
52
|
-
-
|
53
|
-
|
54
|
-
|
55
|
-
- anything else: disabled
|
56
|
-
- Runtime value: 0/1=do not/do highlight next time.
|
51
|
+
alternating_logs:
|
52
|
+
- 0: disabled
|
53
|
+
- 1: enabled for dark background
|
54
|
+
- 2: enabled for light background
|
57
55
|
"""
|
58
56
|
|
59
57
|
kind: h.ClassVar[str] = "c"
|
60
58
|
|
61
|
-
|
62
|
-
console: console_t = d.field(init=False)
|
63
|
-
MessageFromRecord: MessageFromRecordPreprocessed_p = d.field(init=False)
|
64
|
-
alternating_lines: int = 0
|
65
|
-
background_is_light: bool = True
|
59
|
+
alternating_logs: int = 0
|
66
60
|
|
67
61
|
name: d.InitVar[str | None] = None
|
68
62
|
level: d.InitVar[int] = l.NOTSET
|
69
63
|
should_store_memory_usage: d.InitVar[bool] = False
|
70
64
|
message_width: d.InitVar[int] = -1
|
71
65
|
formatter: d.InitVar[l.Formatter | None] = None
|
66
|
+
#
|
72
67
|
should_install_traceback: d.InitVar[bool] = False
|
73
68
|
should_record: d.InitVar[bool] = False
|
74
|
-
|
75
69
|
rich_kwargs: d.InitVar[dict[str, h.Any] | None] = None
|
76
70
|
|
71
|
+
extension: handler_extension_t = d.field(init=False)
|
72
|
+
console: console_t = d.field(init=False)
|
73
|
+
MessageFromRecord: MessageFromRecordPreprocessed_p = d.field(init=False)
|
74
|
+
log_parity: bool = d.field(init=False, default=False)
|
75
|
+
|
77
76
|
@property
|
78
77
|
def past_logs_as_HTML(self) -> str | None:
|
79
78
|
""""""
|
@@ -130,14 +129,7 @@ class console_rich_handler_t(l.Handler):
|
|
130
129
|
InstallTracebackHandler(**rich_traceback_kwargs)
|
131
130
|
|
132
131
|
self.MessageFromRecord = self.extension.MessageFromRecord
|
133
|
-
|
134
|
-
self.alternating_lines = 0
|
135
|
-
self.background_is_light = False
|
136
|
-
elif self.alternating_lines == 2:
|
137
|
-
self.alternating_lines = 0
|
138
|
-
self.background_is_light = True
|
139
|
-
else:
|
140
|
-
self.alternating_lines = -1
|
132
|
+
assert self.alternating_logs in (0, 1, 2)
|
141
133
|
|
142
134
|
def emit(self, record: l.LogRecord, /) -> None:
|
143
135
|
""""""
|
@@ -145,17 +137,15 @@ class console_rich_handler_t(l.Handler):
|
|
145
137
|
richer = Rule(record.msg, DATE_TIME_COLOR)
|
146
138
|
else:
|
147
139
|
message = self.MessageFromRecord(record, PreProcessed=EscapedVersion)
|
148
|
-
should_highlight_back = self.alternating_lines == 1
|
149
|
-
if self.alternating_lines >= 0:
|
150
|
-
self.alternating_lines = (self.alternating_lines + 1) % 2
|
151
140
|
richer = HighlightedVersion(
|
152
141
|
self.console,
|
153
142
|
message,
|
154
143
|
record.levelno,
|
155
|
-
|
156
|
-
|
144
|
+
self.alternating_logs,
|
145
|
+
self.log_parity,
|
157
146
|
)
|
158
147
|
self.console.print(richer, crop=False, overflow="ignore")
|
148
|
+
self.log_parity = not self.log_parity
|
159
149
|
|
160
150
|
def LogAsIs(self, message: str | renderable_t, /) -> None:
|
161
151
|
"""
|
@@ -173,10 +163,9 @@ def HighlightedVersion(
|
|
173
163
|
_: console_t,
|
174
164
|
message: str,
|
175
165
|
log_level: int,
|
166
|
+
alternating_logs: int,
|
167
|
+
should_tint_background: bool,
|
176
168
|
/,
|
177
|
-
*,
|
178
|
-
should_highlight_back: bool = False,
|
179
|
-
background_is_light: bool = True,
|
180
169
|
) -> renderable_t:
|
181
170
|
""""""
|
182
171
|
output = text_t(message, WHITE_COLOR)
|
@@ -188,11 +177,11 @@ def HighlightedVersion(
|
|
188
177
|
_ = output.highlight_words(ACTUAL_PATTERNS, style=ACTUAL_COLOR)
|
189
178
|
_ = output.highlight_regex(EXPECTED_PATTERNS, style=EXPECTED_COLOR)
|
190
179
|
|
191
|
-
if
|
192
|
-
if
|
193
|
-
style = ALTERNATIVE_BACKGROUND_FOR_LIGHT
|
194
|
-
else:
|
180
|
+
if should_tint_background and (alternating_logs > 0):
|
181
|
+
if alternating_logs == 1:
|
195
182
|
style = ALTERNATIVE_BACKGROUND_FOR_DARK
|
183
|
+
else:
|
184
|
+
style = ALTERNATIVE_BACKGROUND_FOR_LIGHT
|
196
185
|
output.stylize(style)
|
197
186
|
|
198
187
|
return output
|
@@ -30,7 +30,7 @@ class file_handler_t(l.FileHandler):
|
|
30
30
|
should_store_memory_usage: d.InitVar[bool] = False
|
31
31
|
message_width: d.InitVar[int] = -1
|
32
32
|
formatter: d.InitVar[l.Formatter | None] = None
|
33
|
-
|
33
|
+
#
|
34
34
|
path: d.InitVar[path_t | None] = None
|
35
35
|
handler_args: d.InitVar[tuple[h.Any, ...] | None] = None
|
36
36
|
handler_kwargs: d.InitVar[dict[str, h.Any] | None] = None
|
@@ -66,7 +66,7 @@ class file_handler_t(l.FileHandler):
|
|
66
66
|
message = RuleAsText(record.msg)
|
67
67
|
else:
|
68
68
|
message = self.MessageFromRecord(record)
|
69
|
-
|
69
|
+
self.stream.write(message + "\n")
|
70
70
|
self.stream.flush()
|
71
71
|
|
72
72
|
def LogAsIs(self, message: str, /) -> None:
|
@@ -74,7 +74,7 @@ class file_handler_t(l.FileHandler):
|
|
74
74
|
See documentation of
|
75
75
|
logger_36.catalog.handler.generic.generic_handler_t.LogAsIs.
|
76
76
|
"""
|
77
|
-
|
77
|
+
self.stream.write(message + "\n")
|
78
78
|
self.stream.flush()
|
79
79
|
|
80
80
|
def DisplayRule(self, /, *, text: str | None = None, color: str = "white") -> None:
|
@@ -39,12 +39,10 @@ class generic_handler_t(l.Handler):
|
|
39
39
|
"""
|
40
40
|
kind: See logger_36.constant.handler.handler_codes_h.
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
- anything else: disabled
|
47
|
-
- Runtime value: 0/1=do not/do highlight next time.
|
42
|
+
alternating_logs:
|
43
|
+
- 0: disabled
|
44
|
+
- 1: enabled for dark background
|
45
|
+
- 2: enabled for light background
|
48
46
|
|
49
47
|
LogAsIs:
|
50
48
|
Log a message as is, i.e. without formatting. If this is a method, it should
|
@@ -63,19 +61,19 @@ class generic_handler_t(l.Handler):
|
|
63
61
|
# "None -> h.Any" (twice below) since None | None is invalid.
|
64
62
|
console: console_t | h.Any = None
|
65
63
|
console_options: console_options_t | h.Any = None
|
66
|
-
|
67
|
-
background_is_light: bool = True
|
64
|
+
alternating_logs: int = 0
|
68
65
|
|
69
66
|
DisplayRule: DisplayRule_p = d.field(init=False)
|
70
67
|
extension: handler_extension_t = d.field(init=False)
|
71
68
|
MessageFromRecord: MessageFromRecord_h = d.field(init=False)
|
69
|
+
log_parity: bool = d.field(init=False, default=False)
|
72
70
|
|
73
71
|
name: d.InitVar[str | None] = None
|
74
72
|
level: d.InitVar[int] = l.NOTSET
|
75
73
|
should_store_memory_usage: d.InitVar[bool] = False
|
76
74
|
message_width: d.InitVar[int] = -1
|
77
75
|
formatter: d.InitVar[l.Formatter | None] = None
|
78
|
-
|
76
|
+
#
|
79
77
|
supports_html: d.InitVar[bool] = False
|
80
78
|
should_record: d.InitVar[bool] = False
|
81
79
|
rich_kwargs: d.InitVar[dict[str, h.Any] | None] = None
|
@@ -120,14 +118,7 @@ class generic_handler_t(l.Handler):
|
|
120
118
|
self.DisplayRule = self._DisplayRuleAsText
|
121
119
|
|
122
120
|
self.MessageFromRecord = self.extension.MessageFromRecord
|
123
|
-
|
124
|
-
self.alternating_lines = 0
|
125
|
-
self.background_is_light = False
|
126
|
-
elif self.alternating_lines == 2:
|
127
|
-
self.alternating_lines = 0
|
128
|
-
self.background_is_light = True
|
129
|
-
else:
|
130
|
-
self.alternating_lines = -1
|
121
|
+
assert self.alternating_logs in (0, 1, 2)
|
131
122
|
|
132
123
|
def emit(self, record: l.LogRecord, /) -> None:
|
133
124
|
""""""
|
@@ -141,15 +132,12 @@ class generic_handler_t(l.Handler):
|
|
141
132
|
richer = Rule(record.msg, DATE_TIME_COLOR)
|
142
133
|
else:
|
143
134
|
message = self.MessageFromRecord(record, PreProcessed=EscapedForRich)
|
144
|
-
should_highlight_back = self.alternating_lines == 1
|
145
|
-
if self.alternating_lines >= 0:
|
146
|
-
self.alternating_lines = (self.alternating_lines + 1) % 2
|
147
135
|
richer = HighlightedVersion(
|
148
136
|
self.console,
|
149
137
|
message,
|
150
138
|
record.levelno,
|
151
|
-
|
152
|
-
|
139
|
+
self.alternating_logs,
|
140
|
+
self.log_parity,
|
153
141
|
)
|
154
142
|
segments = self.console.render(richer, options=self.console_options)
|
155
143
|
|
@@ -176,6 +164,7 @@ class generic_handler_t(l.Handler):
|
|
176
164
|
)
|
177
165
|
|
178
166
|
self.LogAsIs(message)
|
167
|
+
self.log_parity = not self.log_parity
|
179
168
|
|
180
169
|
def _DisplayRuleAsText(
|
181
170
|
self, /, *, text: str | None = None, color: str = "white"
|
logger_36/catalog/logger/gpu.py
CHANGED
@@ -26,7 +26,7 @@ def LogGPURelatedDetails(*, logger: logger_t = L) -> None:
|
|
26
26
|
|
27
27
|
if None in (tsfl, tsrt):
|
28
28
|
if _GPU_LOGGING_ERROR is not None:
|
29
|
-
|
29
|
+
s.__stderr__.write(_GPU_LOGGING_ERROR + "\n")
|
30
30
|
_GPU_LOGGING_ERROR = None
|
31
31
|
return
|
32
32
|
|
logger_36/exception.py
CHANGED
@@ -76,14 +76,13 @@ def _HandleException(
|
|
76
76
|
|
77
77
|
document = tmpf.NamedTemporaryFile(delete=False)
|
78
78
|
|
79
|
-
|
79
|
+
s.__stderr__.write(
|
80
80
|
f"{stripe.__name__}\n"
|
81
81
|
f" {module}:{function}@{line_number}\n"
|
82
82
|
f"{line_content}"
|
83
83
|
f"{variables}"
|
84
84
|
f"{message}"
|
85
|
-
f" Full report at: {document.name}",
|
86
|
-
file=s.stderr,
|
85
|
+
f" Full report at: {document.name}\n",
|
87
86
|
)
|
88
87
|
|
89
88
|
lines = tcbk.format_exception(exception)
|
logger_36/handler.py
CHANGED
@@ -33,7 +33,7 @@ def AddGenericHandler(
|
|
33
33
|
message_width: int = -1,
|
34
34
|
formatter: l.Formatter | None = None,
|
35
35
|
supports_html: bool = False,
|
36
|
-
|
36
|
+
alternating_logs: int = 0,
|
37
37
|
should_record: bool = False,
|
38
38
|
should_hold_messages: bool = False,
|
39
39
|
**kwargs,
|
@@ -46,7 +46,7 @@ def AddGenericHandler(
|
|
46
46
|
message_width=message_width,
|
47
47
|
formatter=formatter,
|
48
48
|
supports_html=supports_html,
|
49
|
-
|
49
|
+
alternating_logs=alternating_logs,
|
50
50
|
should_record=should_record,
|
51
51
|
rich_kwargs=kwargs,
|
52
52
|
LogAsIs=LogAsIs,
|
@@ -85,7 +85,7 @@ def AddRichConsoleHandler(
|
|
85
85
|
should_store_memory_usage: bool = False,
|
86
86
|
message_width: int = -1,
|
87
87
|
formatter: l.Formatter | None = None,
|
88
|
-
|
88
|
+
alternating_logs: int = 0,
|
89
89
|
should_hold_messages: bool = False,
|
90
90
|
should_install_traceback: bool = False,
|
91
91
|
should_record: bool = False,
|
@@ -94,14 +94,14 @@ def AddRichConsoleHandler(
|
|
94
94
|
""""""
|
95
95
|
global _MISSING_RICH_MESSAGE
|
96
96
|
if _MISSING_RICH_MESSAGE is not None:
|
97
|
-
|
97
|
+
s.__stderr__.write(_MISSING_RICH_MESSAGE + "\n")
|
98
98
|
_MISSING_RICH_MESSAGE = None
|
99
99
|
|
100
100
|
if console_rich_handler_t is console_handler_t:
|
101
101
|
additional_s = {}
|
102
102
|
else:
|
103
103
|
additional_s = {
|
104
|
-
"
|
104
|
+
"alternating_logs": alternating_logs,
|
105
105
|
"should_install_traceback": should_install_traceback,
|
106
106
|
"should_record": should_record,
|
107
107
|
"rich_kwargs": kwargs,
|
logger_36/type/handler.py
CHANGED
@@ -73,7 +73,7 @@ class handler_extension_t:
|
|
73
73
|
if self.should_store_memory_usage and not CanCheckMemoryUsage():
|
74
74
|
self.should_store_memory_usage = False
|
75
75
|
if _MEMORY_MEASURE_ERROR is not None:
|
76
|
-
|
76
|
+
s.__stderr__.write(_MEMORY_MEASURE_ERROR + "\n")
|
77
77
|
_MEMORY_MEASURE_ERROR = None
|
78
78
|
|
79
79
|
handler.setLevel(level)
|
logger_36/type/logger.py
CHANGED
@@ -63,11 +63,14 @@ class logger_t(base_t):
|
|
63
63
|
"""
|
64
64
|
intercepted_wrn_handle: When warning interception is on, this stores the original
|
65
65
|
"handle" method of the Python warning logger.
|
66
|
-
"""
|
67
66
|
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
should_activate_log_interceptions: Loggers instantiated after a logger_t logger will
|
68
|
+
be missed by an early call of ToggleLogInterceptions. Therefore, passing True for
|
69
|
+
activate_log_interceptions only sets should_activate_log_interceptions to True,
|
70
|
+
which is later checked in AddHandler to effectively call ToggleLogInterceptions if
|
71
|
+
should_hold_messages is False (which normally indicates that the handler about to be
|
72
|
+
added is the last one).
|
73
|
+
"""
|
71
74
|
|
72
75
|
# Must not be False until at least one handler has been added.
|
73
76
|
should_hold_messages: bool = True
|
@@ -86,6 +89,12 @@ class logger_t(base_t):
|
|
86
89
|
intercepted_log_handles: dict[str, logger_handle_h] = d.field(
|
87
90
|
init=False, default_factory=dict
|
88
91
|
)
|
92
|
+
should_activate_log_interceptions: bool = False
|
93
|
+
|
94
|
+
name_: d.InitVar[str] = LOGGER_NAME
|
95
|
+
level_: d.InitVar[int] = l.NOTSET
|
96
|
+
activate_wrn_interceptions: d.InitVar[bool] = True
|
97
|
+
activate_log_interceptions: d.InitVar[bool] = True
|
89
98
|
|
90
99
|
@property
|
91
100
|
def intercepts_warnings(self) -> bool:
|
@@ -133,7 +142,11 @@ class logger_t(base_t):
|
|
133
142
|
return "?", UNKNOWN_MEMORY_USAGE
|
134
143
|
|
135
144
|
def __post_init__(
|
136
|
-
self,
|
145
|
+
self,
|
146
|
+
name_: str,
|
147
|
+
level_: int,
|
148
|
+
activate_wrn_interceptions: bool,
|
149
|
+
activate_log_interceptions: bool,
|
137
150
|
) -> None:
|
138
151
|
""""""
|
139
152
|
base_t.__init__(self, name_)
|
@@ -147,6 +160,9 @@ class logger_t(base_t):
|
|
147
160
|
|
148
161
|
if activate_wrn_interceptions:
|
149
162
|
self.ToggleWarningInterceptions(True)
|
163
|
+
if activate_log_interceptions:
|
164
|
+
self.should_activate_log_interceptions = True
|
165
|
+
|
150
166
|
if self.exit_on_error:
|
151
167
|
self.exit_on_critical = True
|
152
168
|
|
@@ -262,72 +278,31 @@ class logger_t(base_t):
|
|
262
278
|
)
|
263
279
|
)
|
264
280
|
|
265
|
-
def MakeMonochrome(
|
266
|
-
self,
|
267
|
-
*,
|
268
|
-
should_intercept_logs: bool = True,
|
269
|
-
should_override_exceptions: bool = True,
|
270
|
-
) -> None:
|
281
|
+
def MakeMonochrome(self) -> None:
|
271
282
|
""""""
|
272
|
-
|
273
|
-
should_intercept_logs=should_intercept_logs,
|
274
|
-
should_override_exceptions=should_override_exceptions,
|
275
|
-
)
|
283
|
+
OverrideExceptionFormat()
|
276
284
|
AddConsoleHandler(self)
|
277
285
|
|
278
|
-
def MakeRich(
|
279
|
-
self,
|
280
|
-
*,
|
281
|
-
alternating_lines: int = 2,
|
282
|
-
should_intercept_logs: bool = True,
|
283
|
-
should_override_exceptions: bool = True,
|
284
|
-
) -> None:
|
286
|
+
def MakeRich(self, *, alternating_logs: int = 0) -> None:
|
285
287
|
""""""
|
286
|
-
|
287
|
-
|
288
|
-
should_override_exceptions=should_override_exceptions,
|
289
|
-
)
|
290
|
-
AddRichConsoleHandler(self, alternating_lines=alternating_lines)
|
288
|
+
OverrideExceptionFormat()
|
289
|
+
AddRichConsoleHandler(self, alternating_logs=alternating_logs)
|
291
290
|
|
292
|
-
def MakePermanent(
|
293
|
-
self,
|
294
|
-
path: str | path_t,
|
295
|
-
/,
|
296
|
-
*,
|
297
|
-
should_intercept_logs: bool = True,
|
298
|
-
should_override_exceptions: bool = True,
|
299
|
-
) -> None:
|
291
|
+
def MakePermanent(self, path: str | path_t, /) -> None:
|
300
292
|
""""""
|
301
|
-
|
302
|
-
should_intercept_logs=should_intercept_logs,
|
303
|
-
should_override_exceptions=should_override_exceptions,
|
304
|
-
)
|
293
|
+
OverrideExceptionFormat()
|
305
294
|
AddFileHandler(self, path)
|
306
295
|
|
307
|
-
def _MakePreamble(
|
308
|
-
self,
|
309
|
-
*,
|
310
|
-
should_intercept_logs: bool = True,
|
311
|
-
should_override_exceptions: bool = True,
|
312
|
-
) -> None:
|
313
|
-
""""""
|
314
|
-
if should_override_exceptions:
|
315
|
-
OverrideExceptionFormat()
|
316
|
-
if should_intercept_logs:
|
317
|
-
self.ToggleLogInterceptions(True)
|
318
|
-
|
319
296
|
def ResetEventCounts(self) -> None:
|
320
297
|
""""""
|
321
298
|
for level in self.events:
|
322
299
|
self.events[level] = 0
|
323
300
|
|
324
301
|
def ToggleWarningInterceptions(self, state: bool, /) -> None:
|
325
|
-
"""
|
326
|
-
The log message will not appear if called from __post_init__ since there are no
|
327
|
-
handlers yet.
|
328
|
-
"""
|
302
|
+
""""""
|
329
303
|
if state:
|
330
|
-
|
304
|
+
if self.intercepts_warnings:
|
305
|
+
return
|
331
306
|
|
332
307
|
logger = l.getLogger(WARNING_LOGGER_NAME)
|
333
308
|
self.intercepted_wrn_handle = logger.handle
|
@@ -336,7 +311,8 @@ class logger_t(base_t):
|
|
336
311
|
l.captureWarnings(True)
|
337
312
|
self.info("Warning Interception: ON")
|
338
313
|
else:
|
339
|
-
|
314
|
+
if not self.intercepts_warnings:
|
315
|
+
return
|
340
316
|
|
341
317
|
logger = l.getLogger(WARNING_LOGGER_NAME)
|
342
318
|
logger.handle = self.intercepted_wrn_handle
|
@@ -348,12 +324,14 @@ class logger_t(base_t):
|
|
348
324
|
def ToggleLogInterceptions(self, state: bool, /) -> None:
|
349
325
|
""""""
|
350
326
|
if state:
|
351
|
-
|
327
|
+
if self.intercepts_logs:
|
328
|
+
return
|
352
329
|
|
353
330
|
# Note: Alternative to self.manager is logging.root.manager.
|
331
|
+
all_loggers_names_but_root = self.manager.loggerDict.keys()
|
354
332
|
all_loggers = [l.getLogger()] + [
|
355
333
|
l.getLogger(_nme)
|
356
|
-
for _nme in
|
334
|
+
for _nme in all_loggers_names_but_root
|
357
335
|
if _nme not in (self.name, WARNING_LOGGER_NAME)
|
358
336
|
]
|
359
337
|
for logger in all_loggers:
|
@@ -367,7 +345,8 @@ class logger_t(base_t):
|
|
367
345
|
as_str = ", ".join(intercepted)
|
368
346
|
self.info(f"Now Intercepting LOGs from: {as_str}")
|
369
347
|
else:
|
370
|
-
|
348
|
+
if not self.intercepts_logs:
|
349
|
+
return
|
371
350
|
|
372
351
|
for name, handle in self.intercepted_log_handles.items():
|
373
352
|
logger = l.getLogger(name)
|
@@ -379,6 +358,10 @@ class logger_t(base_t):
|
|
379
358
|
self, handler: l.Handler, /, *, should_hold_messages: bool = False
|
380
359
|
) -> None:
|
381
360
|
""""""
|
361
|
+
if (not should_hold_messages) and self.should_activate_log_interceptions:
|
362
|
+
self.ToggleLogInterceptions(True)
|
363
|
+
self.should_activate_log_interceptions = False
|
364
|
+
|
382
365
|
self.should_hold_messages = should_hold_messages
|
383
366
|
base_t.addHandler(self, handler)
|
384
367
|
|
@@ -596,13 +579,18 @@ def _HandleForWarnings(interceptor: base_t, /) -> logger_handle_h:
|
|
596
579
|
path = GetPiece(1)
|
597
580
|
line = GetPiece(2)
|
598
581
|
kind = GetPiece(3)
|
599
|
-
message = GetPiece(4)
|
582
|
+
message = GetPiece(4)
|
583
|
+
|
584
|
+
path_as_t = path_t(path)
|
585
|
+
line = int(line)
|
586
|
+
line_content = path_as_t.read_text().splitlines()[line - 1]
|
587
|
+
message = message.replace(line_content.strip(), "").strip()
|
600
588
|
|
601
589
|
duplicate = l.makeLogRecord(record.__dict__)
|
602
590
|
duplicate.msg = f"{kind}: {message}"
|
603
591
|
duplicate.pathname = path
|
604
|
-
duplicate.module =
|
605
|
-
duplicate.funcName = "
|
592
|
+
duplicate.module = path_as_t.stem
|
593
|
+
duplicate.funcName = "<function>"
|
606
594
|
duplicate.lineno = line
|
607
595
|
|
608
596
|
interceptor.handle(duplicate)
|
logger_36/version.py
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
logger_36/__init__.py,sha256=3BtAgxFb14e9zzC5fXwqSQxstsd3BO0b_KVu3_wbLwg,2592
|
2
2
|
logger_36/content.py,sha256=clHYYUKa8n4qef6PVlUV4mFHRRf6fnm9wEd2fu9oagA,2381
|
3
|
-
logger_36/exception.py,sha256=
|
3
|
+
logger_36/exception.py,sha256=9YWnS2LN_Mc0qYkohtbgEkzKe9ja2h_dBEd39ytGbRU,4605
|
4
4
|
logger_36/gpu.py,sha256=BOumedCAPWvCo7J-KJ3XE-jr5S0KSmgcFv_S4QKRPO8,2252
|
5
|
-
logger_36/handler.py,sha256=
|
5
|
+
logger_36/handler.py,sha256=fYc9L0RkMnlwKH_dSwOEeOV61D-L3zd-hxbPkzEvKbY,6303
|
6
6
|
logger_36/memory.py,sha256=szJVk4UTXsbYv3B-W9LFttf1F3j86GXHsKgEUOsXKl4,2743
|
7
7
|
logger_36/storage.py,sha256=sCxkHQH4xMaseweK1p2M1j0j2PxNPpy9MytPdg1sKiQ,2239
|
8
8
|
logger_36/system.py,sha256=cgOMF_OneYeIJDMbIbIDx96EZss2uAdkk8QofOC7O1U,2251
|
9
9
|
logger_36/time.py,sha256=Uw1jQtY1njsRuIPRAXX44v4nPOo84MSBu_WK_YCRzQs,2324
|
10
|
-
logger_36/version.py,sha256=
|
10
|
+
logger_36/version.py,sha256=iy6wT5BEzB1vF_6nT0az2cXgwzIOb0RrSrqWYu1gq5g,2206
|
11
11
|
logger_36/api/logger.py,sha256=TE3ATbymeWX-wBKBFkVz2FxUyJnaqY7vzFwAONVsp2o,2233
|
12
12
|
logger_36/api/storage.py,sha256=v1iywLEItJCz18F_nJ20OnlpCpLdA-7EhlvqdLu42js,2243
|
13
13
|
logger_36/catalog/config/console_rich.py,sha256=lAa5Ev5BhXvmQzfIt1FNihMNUQJFlXaIzNanAMdgtd0,2861
|
14
14
|
logger_36/catalog/config/optional.py,sha256=HaN6mbx7gHBBppNvUw1ckhYTOrlYqb-b_r0mzPcHPjM,2398
|
15
|
-
logger_36/catalog/handler/console.py,sha256=
|
16
|
-
logger_36/catalog/handler/console_rich.py,sha256=
|
17
|
-
logger_36/catalog/handler/file.py,sha256=
|
18
|
-
logger_36/catalog/handler/generic.py,sha256=
|
15
|
+
logger_36/catalog/handler/console.py,sha256=13ygxLmsywdGlr9hV9guw7FuRD-dxlZX20d1Mn-pWKs,4206
|
16
|
+
logger_36/catalog/handler/console_rich.py,sha256=RrNp8Uqf_MVw6o3Qcf7-4AfsZM_TjaTR2L_FKqD6LjI,8033
|
17
|
+
logger_36/catalog/handler/file.py,sha256=ZbYLic0XcX3vw-col8hiuO-SQOSZh06tPYu5z3FdGDo,4620
|
18
|
+
logger_36/catalog/handler/generic.py,sha256=YYVdfG5nJHLIC-W9p8YhRREyFFSjJGHfSKJFd9EtLp0,8663
|
19
19
|
logger_36/catalog/logger/chronos.py,sha256=ocY13f98EfknU7wZCv0FS9Xb7pTNaWCPSusXFIEvEd4,2437
|
20
|
-
logger_36/catalog/logger/gpu.py,sha256=
|
20
|
+
logger_36/catalog/logger/gpu.py,sha256=n_kbAQdRNk3Jdket6031_r2unOcz3dWplhCR-WFPjE0,3417
|
21
21
|
logger_36/catalog/logger/memory.py,sha256=CWhr2J4BqArJxzH6tS-ZThr-rYPAQGtuLn0pP7Iryfg,4685
|
22
22
|
logger_36/catalog/logger/system.py,sha256=KXP2jdPd-ACFNdA0wWdmOLwuxt4baUvXkuChyOHyfy0,3066
|
23
23
|
logger_36/config/issue.py,sha256=G-i5p6lhZCLAOa-VTMyL9ZonvGCvhdoQ5KZdSWgP-FU,2267
|
@@ -44,11 +44,11 @@ logger_36/task/format/message.py,sha256=T2V2gUlUQqSojyRrz4I4uAHwNe6eBEsuAe6V-LTy
|
|
44
44
|
logger_36/task/format/rule.py,sha256=vkf-HivFb4VqV2GeOPVqMAp99krtziI-kXhox3UVnzw,2873
|
45
45
|
logger_36/task/measure/chronos.py,sha256=1kVhu6jZlNAtNWQQh8ZVuRwZIAC9gGz3_ul1tn0t4Yw,3055
|
46
46
|
logger_36/task/measure/memory.py,sha256=OjU5EYFH8SnzlCQKAoiXvauUlwQYOrH34jFXTVYF0jE,2517
|
47
|
-
logger_36/type/handler.py,sha256
|
47
|
+
logger_36/type/handler.py,sha256=5g5KdmKk6cdsUSV0JoFfjpAXdQIzSRcW81STyLqqWq8,6824
|
48
48
|
logger_36/type/issue.py,sha256=2rGsFqaQJCbeml9xN08mN_nK79L8qscaS_0ws36Y0bI,3214
|
49
|
-
logger_36/type/logger.py,sha256=
|
49
|
+
logger_36/type/logger.py,sha256=uqv5948_V8cUi_PBwtLGGNDcYe8NfaePQcZXvviCs9w,22802
|
50
50
|
logger_36/type/loggers.py,sha256=znqxWBnfQxvkg3VUfbTUvt3S6Kq0DAzWWepxQDt9suI,2871
|
51
|
-
logger_36-2025.
|
52
|
-
logger_36-2025.
|
53
|
-
logger_36-2025.
|
54
|
-
logger_36-2025.
|
51
|
+
logger_36-2025.10.dist-info/METADATA,sha256=SD9qdZj7hf8PpN1Aezr9JYsUWaM7N2Grv-cBfT5BlHw,6506
|
52
|
+
logger_36-2025.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
53
|
+
logger_36-2025.10.dist-info/top_level.txt,sha256=sM95BTMWmslEEgR_1pzwZsOeSp8C_QBiu8ImbFr0XLc,10
|
54
|
+
logger_36-2025.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|