logger-36 2025.4__py3-none-any.whl → 2025.5__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/__init__.py +2 -1
- logger_36/catalog/config/console_rich.py +7 -7
- logger_36/catalog/handler/console.py +7 -7
- logger_36/catalog/handler/console_rich.py +7 -7
- logger_36/catalog/handler/file.py +7 -7
- logger_36/catalog/handler/generic.py +7 -7
- logger_36/catalog/logger/chronos.py +2 -2
- logger_36/catalog/logger/gpu.py +4 -4
- logger_36/catalog/logger/memory.py +3 -3
- logger_36/catalog/logger/system.py +2 -2
- logger_36/config/logger.py +3 -6
- logger_36/constant/logger.py +2 -2
- logger_36/exception.py +6 -6
- logger_36/handler.py +17 -27
- logger_36/instance/logger.py +1 -1
- logger_36/task/inspection.py +3 -3
- logger_36/task/measure/chronos.py +1 -3
- logger_36/task/storage.py +10 -12
- logger_36/type/handler.py +8 -8
- logger_36/type/issue.py +2 -2
- logger_36/type/logger.py +41 -33
- logger_36/version.py +1 -1
- {logger_36-2025.4.dist-info → logger_36-2025.5.dist-info}/METADATA +1 -1
- {logger_36-2025.4.dist-info → logger_36-2025.5.dist-info}/RECORD +26 -26
- {logger_36-2025.4.dist-info → logger_36-2025.5.dist-info}/WHEEL +0 -0
- {logger_36-2025.4.dist-info → logger_36-2025.5.dist-info}/top_level.txt +0 -0
logger_36/__init__.py
CHANGED
@@ -11,12 +11,13 @@ except ModuleNotFoundError:
|
|
11
11
|
else:
|
12
12
|
import site
|
13
13
|
from pathlib import Path as path_t
|
14
|
+
|
14
15
|
paths = site.getsitepackages() + [site.getusersitepackages()]
|
15
16
|
folder = path_t(__file__).parent
|
16
17
|
if folder not in paths:
|
17
18
|
beartype_this_package()
|
18
19
|
|
19
|
-
from logger_36.instance.logger import
|
20
|
+
from logger_36.instance.logger import L
|
20
21
|
from logger_36.version import __version__
|
21
22
|
|
22
23
|
"""
|
@@ -4,7 +4,7 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
|
4
4
|
SEE COPYRIGHT NOTICE BELOW
|
5
5
|
"""
|
6
6
|
|
7
|
-
import logging as
|
7
|
+
import logging as l
|
8
8
|
|
9
9
|
from rich.color import Color as color_t
|
10
10
|
from rich.style import Style as style_t
|
@@ -16,13 +16,13 @@ WHITE_COLOR = "grey85"
|
|
16
16
|
GRAY_COLOR = "grey58"
|
17
17
|
|
18
18
|
LEVEL_COLOR: dict[int, str | style_t] = {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
l.DEBUG: "orchid",
|
20
|
+
l.INFO: GRAY_COLOR,
|
21
|
+
l.WARNING: "yellow1",
|
22
|
+
l.ERROR: "dark_orange",
|
23
|
+
l.CRITICAL: "bright_red",
|
24
24
|
}
|
25
|
-
ACTUAL_COLOR = LEVEL_COLOR[
|
25
|
+
ACTUAL_COLOR = LEVEL_COLOR[l.CRITICAL]
|
26
26
|
EXPECTED_COLOR = "green3"
|
27
27
|
DATE_TIME_COLOR = "sky_blue3"
|
28
28
|
|
@@ -5,7 +5,7 @@ SEE COPYRIGHT NOTICE BELOW
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
import dataclasses as d
|
8
|
-
import logging as
|
8
|
+
import logging as l
|
9
9
|
import textwrap as txt_
|
10
10
|
import typing as h
|
11
11
|
|
@@ -16,15 +16,15 @@ from logger_36.type.handler import handler_extension_t
|
|
16
16
|
|
17
17
|
|
18
18
|
@d.dataclass(slots=True, repr=False, eq=False)
|
19
|
-
class console_handler_t(
|
19
|
+
class console_handler_t(l.Handler):
|
20
20
|
extension: handler_extension_t = d.field(init=False)
|
21
21
|
MessageFromRecord: h.Callable[..., tuple[str, str | None]] = d.field(init=False)
|
22
22
|
|
23
23
|
name: d.InitVar[str | None] = None
|
24
|
-
level: d.InitVar[int] =
|
24
|
+
level: d.InitVar[int] = l.NOTSET
|
25
25
|
should_store_memory_usage: d.InitVar[bool] = False
|
26
26
|
message_width: d.InitVar[int] = -1
|
27
|
-
formatter: d.InitVar[
|
27
|
+
formatter: d.InitVar[l.Formatter | None] = None
|
28
28
|
|
29
29
|
def __post_init__(
|
30
30
|
self,
|
@@ -32,10 +32,10 @@ class console_handler_t(lggg.Handler):
|
|
32
32
|
level: int,
|
33
33
|
should_store_memory_usage: bool,
|
34
34
|
message_width: int,
|
35
|
-
formatter:
|
35
|
+
formatter: l.Formatter | None,
|
36
36
|
) -> None:
|
37
37
|
""""""
|
38
|
-
|
38
|
+
l.Handler.__init__(self)
|
39
39
|
|
40
40
|
self.extension = handler_extension_t(
|
41
41
|
name=name,
|
@@ -48,7 +48,7 @@ class console_handler_t(lggg.Handler):
|
|
48
48
|
|
49
49
|
self.MessageFromRecord = self.extension.MessageFromRecord
|
50
50
|
|
51
|
-
def emit(self, record:
|
51
|
+
def emit(self, record: l.LogRecord, /) -> None:
|
52
52
|
""""""
|
53
53
|
if hasattr(record, SHOW_W_RULE_ATTR):
|
54
54
|
message = RuleAsText(record.msg)
|
@@ -5,7 +5,7 @@ SEE COPYRIGHT NOTICE BELOW
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
import dataclasses as d
|
8
|
-
import logging as
|
8
|
+
import logging as l
|
9
9
|
import textwrap as txt_
|
10
10
|
import typing as h
|
11
11
|
|
@@ -45,7 +45,7 @@ _EXCLUSIVE_TRACEBACK_ARGUMENTS = (
|
|
45
45
|
|
46
46
|
|
47
47
|
@d.dataclass(slots=True, repr=False, eq=False)
|
48
|
-
class console_rich_handler_t(
|
48
|
+
class console_rich_handler_t(l.Handler):
|
49
49
|
"""
|
50
50
|
alternating_lines:
|
51
51
|
- Initial value:
|
@@ -62,10 +62,10 @@ class console_rich_handler_t(lggg.Handler):
|
|
62
62
|
background_is_light: bool = True
|
63
63
|
|
64
64
|
name: d.InitVar[str | None] = None
|
65
|
-
level: d.InitVar[int] =
|
65
|
+
level: d.InitVar[int] = l.NOTSET
|
66
66
|
should_store_memory_usage: d.InitVar[bool] = False
|
67
67
|
message_width: d.InitVar[int] = -1
|
68
|
-
formatter: d.InitVar[
|
68
|
+
formatter: d.InitVar[l.Formatter | None] = None
|
69
69
|
should_install_traceback: d.InitVar[bool] = False
|
70
70
|
should_record: d.InitVar[bool] = False
|
71
71
|
|
@@ -77,13 +77,13 @@ class console_rich_handler_t(lggg.Handler):
|
|
77
77
|
level: int,
|
78
78
|
should_store_memory_usage: bool,
|
79
79
|
message_width: int,
|
80
|
-
formatter:
|
80
|
+
formatter: l.Formatter | None,
|
81
81
|
should_install_traceback: bool,
|
82
82
|
should_record: bool,
|
83
83
|
rich_kwargs: dict[str, h.Any] | None,
|
84
84
|
) -> None:
|
85
85
|
""""""
|
86
|
-
|
86
|
+
l.Handler.__init__(self)
|
87
87
|
|
88
88
|
self.extension = handler_extension_t(
|
89
89
|
name=name,
|
@@ -127,7 +127,7 @@ class console_rich_handler_t(lggg.Handler):
|
|
127
127
|
else:
|
128
128
|
self.alternating_lines = -1
|
129
129
|
|
130
|
-
def emit(self, record:
|
130
|
+
def emit(self, record: l.LogRecord, /) -> None:
|
131
131
|
""""""
|
132
132
|
if hasattr(record, SHOW_W_RULE_ATTR):
|
133
133
|
richer = Rule(record.msg, DATE_TIME_COLOR)
|
@@ -5,7 +5,7 @@ SEE COPYRIGHT NOTICE BELOW
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
import dataclasses as d
|
8
|
-
import logging as
|
8
|
+
import logging as l
|
9
9
|
import textwrap as txt_
|
10
10
|
import typing as h
|
11
11
|
from pathlib import Path as path_t
|
@@ -17,16 +17,16 @@ from logger_36.type.handler import handler_extension_t
|
|
17
17
|
|
18
18
|
|
19
19
|
@d.dataclass(slots=True, repr=False, eq=False)
|
20
|
-
class file_handler_t(
|
20
|
+
class file_handler_t(l.FileHandler):
|
21
21
|
|
22
22
|
extension: handler_extension_t = d.field(init=False)
|
23
23
|
MessageFromRecord: h.Callable[..., tuple[str, str | None]] = d.field(init=False)
|
24
24
|
|
25
25
|
name: d.InitVar[str | None] = None
|
26
|
-
level: d.InitVar[int] =
|
26
|
+
level: d.InitVar[int] = l.NOTSET
|
27
27
|
should_store_memory_usage: d.InitVar[bool] = False
|
28
28
|
message_width: d.InitVar[int] = -1
|
29
|
-
formatter: d.InitVar[
|
29
|
+
formatter: d.InitVar[l.Formatter | None] = None
|
30
30
|
|
31
31
|
path: d.InitVar[path_t | None] = None
|
32
32
|
handler_args: d.InitVar[tuple[h.Any, ...] | None] = None
|
@@ -38,13 +38,13 @@ class file_handler_t(lggg.FileHandler):
|
|
38
38
|
level: int,
|
39
39
|
should_store_memory_usage: bool,
|
40
40
|
message_width: int,
|
41
|
-
formatter:
|
41
|
+
formatter: l.Formatter | None,
|
42
42
|
path: path_t | None,
|
43
43
|
handler_args: tuple[h.Any, ...] | None,
|
44
44
|
handler_kwargs: dict[str, h.Any] | None,
|
45
45
|
) -> None:
|
46
46
|
""""""
|
47
|
-
|
47
|
+
l.FileHandler.__init__(self, path, *handler_args, **handler_kwargs)
|
48
48
|
|
49
49
|
self.extension = handler_extension_t(
|
50
50
|
name=name,
|
@@ -57,7 +57,7 @@ class file_handler_t(lggg.FileHandler):
|
|
57
57
|
|
58
58
|
self.MessageFromRecord = self.extension.MessageFromRecord
|
59
59
|
|
60
|
-
def emit(self, record:
|
60
|
+
def emit(self, record: l.LogRecord, /) -> None:
|
61
61
|
""""""
|
62
62
|
if hasattr(record, SHOW_W_RULE_ATTR):
|
63
63
|
message = RuleAsText(record.msg)
|
@@ -5,7 +5,7 @@ SEE COPYRIGHT NOTICE BELOW
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
import dataclasses as d
|
8
|
-
import logging as
|
8
|
+
import logging as l
|
9
9
|
import typing as h
|
10
10
|
|
11
11
|
try:
|
@@ -34,7 +34,7 @@ class display_rule_p(h.Protocol):
|
|
34
34
|
|
35
35
|
|
36
36
|
@d.dataclass(slots=True, repr=False, eq=False)
|
37
|
-
class generic_handler_t(
|
37
|
+
class generic_handler_t(l.Handler):
|
38
38
|
"""
|
39
39
|
alternating_lines:
|
40
40
|
- Initial value:
|
@@ -66,10 +66,10 @@ class generic_handler_t(lggg.Handler):
|
|
66
66
|
MessageFromRecord: h.Callable[..., tuple[str, str | None]] = d.field(init=False)
|
67
67
|
|
68
68
|
name: d.InitVar[str | None] = None
|
69
|
-
level: d.InitVar[int] =
|
69
|
+
level: d.InitVar[int] = l.NOTSET
|
70
70
|
should_store_memory_usage: d.InitVar[bool] = False
|
71
71
|
message_width: d.InitVar[int] = -1
|
72
|
-
formatter: d.InitVar[
|
72
|
+
formatter: d.InitVar[l.Formatter | None] = None
|
73
73
|
|
74
74
|
supports_html: d.InitVar[bool] = False
|
75
75
|
should_record: d.InitVar[bool] = False
|
@@ -81,13 +81,13 @@ class generic_handler_t(lggg.Handler):
|
|
81
81
|
level: int,
|
82
82
|
should_store_memory_usage: bool,
|
83
83
|
message_width: int,
|
84
|
-
formatter:
|
84
|
+
formatter: l.Formatter | None,
|
85
85
|
supports_html: bool,
|
86
86
|
should_record: bool,
|
87
87
|
rich_kwargs: dict[str, h.Any] | None,
|
88
88
|
) -> None:
|
89
89
|
""""""
|
90
|
-
|
90
|
+
l.Handler.__init__(self)
|
91
91
|
|
92
92
|
self.extension = handler_extension_t(
|
93
93
|
name=name,
|
@@ -124,7 +124,7 @@ class generic_handler_t(lggg.Handler):
|
|
124
124
|
else:
|
125
125
|
self.alternating_lines = -1
|
126
126
|
|
127
|
-
def emit(self, record:
|
127
|
+
def emit(self, record: l.LogRecord, /) -> None:
|
128
128
|
""""""
|
129
129
|
if self.console is None:
|
130
130
|
if hasattr(record, SHOW_W_RULE_ATTR):
|
@@ -4,12 +4,12 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
|
4
4
|
SEE COPYRIGHT NOTICE BELOW
|
5
5
|
"""
|
6
6
|
|
7
|
-
from logger_36.instance.logger import
|
7
|
+
from logger_36.instance.logger import L
|
8
8
|
from logger_36.task.measure.chronos import ElapsedTime
|
9
9
|
from logger_36.type.logger import logger_t
|
10
10
|
|
11
11
|
|
12
|
-
def LogElapsedTime(*, logger: logger_t =
|
12
|
+
def LogElapsedTime(*, logger: logger_t = L) -> None:
|
13
13
|
""""""
|
14
14
|
logger.info(f"Elapsed Time: {ElapsedTime()}")
|
15
15
|
|
logger_36/catalog/logger/gpu.py
CHANGED
@@ -4,10 +4,10 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
|
4
4
|
SEE COPYRIGHT NOTICE BELOW
|
5
5
|
"""
|
6
6
|
|
7
|
-
import sys as
|
7
|
+
import sys as s
|
8
8
|
|
9
9
|
from logger_36.constant.error import GPU_LOGGING_ERROR
|
10
|
-
from logger_36.instance.logger import
|
10
|
+
from logger_36.instance.logger import L
|
11
11
|
from logger_36.type.logger import logger_t
|
12
12
|
|
13
13
|
try:
|
@@ -20,13 +20,13 @@ except ModuleNotFoundError:
|
|
20
20
|
_GPU_LOGGING_ERROR = GPU_LOGGING_ERROR
|
21
21
|
|
22
22
|
|
23
|
-
def LogGPURelatedDetails(*, logger: logger_t =
|
23
|
+
def LogGPURelatedDetails(*, logger: logger_t = L) -> None:
|
24
24
|
""""""
|
25
25
|
global _GPU_LOGGING_ERROR
|
26
26
|
|
27
27
|
if None in (tsfl, tsrt):
|
28
28
|
if _GPU_LOGGING_ERROR is not None:
|
29
|
-
print(_GPU_LOGGING_ERROR, file=
|
29
|
+
print(_GPU_LOGGING_ERROR, file=s.stderr)
|
30
30
|
_GPU_LOGGING_ERROR = None
|
31
31
|
return
|
32
32
|
|
@@ -6,7 +6,7 @@ SEE COPYRIGHT NOTICE BELOW
|
|
6
6
|
|
7
7
|
from logger_36.config.memory import LENGTH_100, MAX_N_SAMPLES
|
8
8
|
from logger_36.constant.memory import storage_units_h
|
9
|
-
from logger_36.instance.logger import
|
9
|
+
from logger_36.instance.logger import L
|
10
10
|
from logger_36.task.format.memory import FormattedUsage, UsageBar
|
11
11
|
from logger_36.task.format.message import MessageWithActualExpected
|
12
12
|
from logger_36.type.logger import logger_t
|
@@ -18,7 +18,7 @@ def LogMemoryUsages(
|
|
18
18
|
decimals: int = None,
|
19
19
|
max_n_samples: int | None = MAX_N_SAMPLES,
|
20
20
|
length_100: int = LENGTH_100,
|
21
|
-
logger: logger_t =
|
21
|
+
logger: logger_t = L,
|
22
22
|
) -> None:
|
23
23
|
""""""
|
24
24
|
if not logger.any_handler_stores_memory:
|
@@ -71,7 +71,7 @@ def LogMaximumMemoryUsage(
|
|
71
71
|
*,
|
72
72
|
unit: storage_units_h | None = "a",
|
73
73
|
decimals: int | None = None,
|
74
|
-
logger: logger_t =
|
74
|
+
logger: logger_t = L,
|
75
75
|
) -> None:
|
76
76
|
"""
|
77
77
|
unit: b or None=bytes, k=kilo, m=mega, g=giga, a=auto
|
@@ -5,7 +5,7 @@ SEE COPYRIGHT NOTICE BELOW
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
from logger_36.constant.system import MAX_DETAIL_NAME_LENGTH, SYSTEM_DETAILS_AS_DICT
|
8
|
-
from logger_36.instance.logger import
|
8
|
+
from logger_36.instance.logger import L
|
9
9
|
from logger_36.task.inspection import Modules
|
10
10
|
from logger_36.type.logger import logger_t
|
11
11
|
|
@@ -15,7 +15,7 @@ def LogSystemDetails(
|
|
15
15
|
modules_with_version: bool = True,
|
16
16
|
modules_formatted: bool = True,
|
17
17
|
should_restrict_modules_to_loaded: bool = True,
|
18
|
-
logger: logger_t =
|
18
|
+
logger: logger_t = L,
|
19
19
|
) -> None:
|
20
20
|
""""""
|
21
21
|
details = "\n".join(
|
logger_36/config/logger.py
CHANGED
@@ -4,14 +4,14 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
|
4
4
|
SEE COPYRIGHT NOTICE BELOW
|
5
5
|
"""
|
6
6
|
|
7
|
-
import logging as
|
7
|
+
import logging as l
|
8
8
|
|
9
9
|
from logger_36.catalog.handler.console import console_handler_t
|
10
10
|
from logger_36.catalog.handler.console_rich import console_rich_handler_t
|
11
11
|
from logger_36.catalog.handler.file import file_handler_t
|
12
12
|
from logger_36.catalog.handler.generic import generic_handler_t
|
13
13
|
from logger_36.constant.handler import HANDLER_CODES, handler_codes_h
|
14
|
-
from logger_36.instance.logger import
|
14
|
+
from logger_36.instance.logger import L
|
15
15
|
from logger_36.task.format.message import MessageWithActualExpected
|
16
16
|
|
17
17
|
|
@@ -19,15 +19,12 @@ def SetLOGLevel(
|
|
19
19
|
level: int,
|
20
20
|
/,
|
21
21
|
*,
|
22
|
-
logger:
|
22
|
+
logger: l.Logger = L,
|
23
23
|
which: handler_codes_h | str = "a",
|
24
24
|
) -> None:
|
25
25
|
"""
|
26
26
|
which: g=generic, c=console, f=file, a=all, str=name.
|
27
27
|
"""
|
28
|
-
if logger is None:
|
29
|
-
logger = LOGGER
|
30
|
-
|
31
28
|
which_is_name = which not in HANDLER_CODES
|
32
29
|
found = False
|
33
30
|
for handler in logger.handlers:
|
logger_36/constant/logger.py
CHANGED
@@ -4,7 +4,7 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
|
4
4
|
SEE COPYRIGHT NOTICE BELOW
|
5
5
|
"""
|
6
6
|
|
7
|
-
import logging as
|
7
|
+
import logging as l
|
8
8
|
import re as regx
|
9
9
|
import typing as h
|
10
10
|
|
@@ -17,7 +17,7 @@ WARNING_TYPE_COMPILED_PATTERN = regx.compile(WARNING_TYPE_PATTERN)
|
|
17
17
|
|
18
18
|
# Second version: with self as first parameter.
|
19
19
|
logger_handle_h = (
|
20
|
-
h.Callable[[
|
20
|
+
h.Callable[[l.LogRecord], None] | h.Callable[[l.Logger, l.LogRecord], None]
|
21
21
|
)
|
22
22
|
|
23
23
|
"""
|
logger_36/exception.py
CHANGED
@@ -4,23 +4,23 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
|
4
4
|
SEE COPYRIGHT NOTICE BELOW
|
5
5
|
"""
|
6
6
|
|
7
|
-
import sys as
|
7
|
+
import sys as s
|
8
8
|
import tempfile as tmpf
|
9
9
|
import traceback as tcbk
|
10
10
|
import types as t
|
11
11
|
from pathlib import Path as path_t
|
12
12
|
|
13
|
-
_ORIGINAL_EXCEPTION_HANDLER =
|
13
|
+
_ORIGINAL_EXCEPTION_HANDLER = s.excepthook
|
14
14
|
|
15
15
|
|
16
16
|
def OverrideExceptionFormat() -> None:
|
17
17
|
""""""
|
18
|
-
|
18
|
+
s.excepthook = _HandleException
|
19
19
|
|
20
20
|
|
21
21
|
def ResetExceptionFormat() -> None:
|
22
22
|
""""""
|
23
|
-
|
23
|
+
s.excepthook = _ORIGINAL_EXCEPTION_HANDLER
|
24
24
|
|
25
25
|
|
26
26
|
def _HandleException(
|
@@ -36,7 +36,7 @@ def _HandleException(
|
|
36
36
|
|
37
37
|
home = str(path_t.home())
|
38
38
|
if module.startswith(home):
|
39
|
-
module = "~" + module[home.__len__():]
|
39
|
+
module = "~" + module[home.__len__() :]
|
40
40
|
|
41
41
|
message = str(exception)
|
42
42
|
if message.__len__() > 0:
|
@@ -48,7 +48,7 @@ def _HandleException(
|
|
48
48
|
f"{stripe.__name__}\n"
|
49
49
|
f" {module}.{function}@{line}\n"
|
50
50
|
f"{message} Full report at: {document.name}",
|
51
|
-
file=
|
51
|
+
file=s.stderr,
|
52
52
|
)
|
53
53
|
|
54
54
|
lines = tcbk.format_exception(exception)
|
logger_36/handler.py
CHANGED
@@ -4,15 +4,14 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
|
4
4
|
SEE COPYRIGHT NOTICE BELOW
|
5
5
|
"""
|
6
6
|
|
7
|
-
import logging as
|
8
|
-
import sys as
|
7
|
+
import logging as l
|
8
|
+
import sys as s
|
9
9
|
from pathlib import Path as path_t
|
10
10
|
|
11
11
|
from logger_36.catalog.handler.console import console_handler_t
|
12
12
|
from logger_36.catalog.handler.file import file_handler_t
|
13
13
|
from logger_36.catalog.handler.generic import generic_handler_t, show_message_p
|
14
14
|
from logger_36.constant.error import MISSING_RICH_ERROR
|
15
|
-
from logger_36.instance.logger import LOGGER
|
16
15
|
|
17
16
|
try:
|
18
17
|
from logger_36.catalog.handler.console_rich import console_rich_handler_t
|
@@ -27,15 +26,15 @@ except ModuleNotFoundError:
|
|
27
26
|
|
28
27
|
|
29
28
|
def AddGenericHandler(
|
29
|
+
logger: l.Logger,
|
30
30
|
ShowMessage: show_message_p,
|
31
31
|
/,
|
32
32
|
*,
|
33
|
-
logger: lggg.Logger | None = None,
|
34
33
|
name: str | None = None,
|
35
|
-
level: int =
|
34
|
+
level: int = l.INFO,
|
36
35
|
should_store_memory_usage: bool = False,
|
37
36
|
message_width: int = -1,
|
38
|
-
formatter:
|
37
|
+
formatter: l.Formatter | None = None,
|
39
38
|
supports_html: bool = False,
|
40
39
|
alternating_lines: int = 2,
|
41
40
|
should_record: bool = False,
|
@@ -43,9 +42,6 @@ def AddGenericHandler(
|
|
43
42
|
**kwargs,
|
44
43
|
) -> None:
|
45
44
|
""""""
|
46
|
-
if logger is None:
|
47
|
-
logger = LOGGER
|
48
|
-
|
49
45
|
handler = generic_handler_t(
|
50
46
|
name=name,
|
51
47
|
level=level,
|
@@ -62,19 +58,17 @@ def AddGenericHandler(
|
|
62
58
|
|
63
59
|
|
64
60
|
def AddConsoleHandler(
|
61
|
+
logger: l.Logger,
|
62
|
+
/,
|
65
63
|
*,
|
66
|
-
logger: lggg.Logger | None = None,
|
67
64
|
name: str | None = None,
|
68
|
-
level: int =
|
65
|
+
level: int = l.INFO,
|
69
66
|
should_store_memory_usage: bool = False,
|
70
67
|
message_width: int = -1,
|
71
|
-
formatter:
|
68
|
+
formatter: l.Formatter | None = None,
|
72
69
|
should_hold_messages: bool = False,
|
73
70
|
) -> None:
|
74
71
|
""""""
|
75
|
-
if logger is None:
|
76
|
-
logger = LOGGER
|
77
|
-
|
78
72
|
handler = console_handler_t(
|
79
73
|
name=name,
|
80
74
|
level=level,
|
@@ -86,13 +80,14 @@ def AddConsoleHandler(
|
|
86
80
|
|
87
81
|
|
88
82
|
def AddRichConsoleHandler(
|
83
|
+
logger: l.Logger,
|
84
|
+
/,
|
89
85
|
*,
|
90
|
-
logger: lggg.Logger | None = None,
|
91
86
|
name: str | None = None,
|
92
|
-
level: int =
|
87
|
+
level: int = l.INFO,
|
93
88
|
should_store_memory_usage: bool = False,
|
94
89
|
message_width: int = -1,
|
95
|
-
formatter:
|
90
|
+
formatter: l.Formatter | None = None,
|
96
91
|
alternating_lines: int = 2,
|
97
92
|
should_hold_messages: bool = False,
|
98
93
|
should_install_traceback: bool = False,
|
@@ -102,12 +97,9 @@ def AddRichConsoleHandler(
|
|
102
97
|
""""""
|
103
98
|
global _MISSING_RICH_ERROR
|
104
99
|
if _MISSING_RICH_ERROR is not None:
|
105
|
-
print(_MISSING_RICH_ERROR, file=
|
100
|
+
print(_MISSING_RICH_ERROR, file=s.stderr)
|
106
101
|
_MISSING_RICH_ERROR = None
|
107
102
|
|
108
|
-
if logger is None:
|
109
|
-
logger = LOGGER
|
110
|
-
|
111
103
|
if console_rich_handler_t is console_handler_t:
|
112
104
|
additional_s = {}
|
113
105
|
else:
|
@@ -129,15 +121,15 @@ def AddRichConsoleHandler(
|
|
129
121
|
|
130
122
|
|
131
123
|
def AddFileHandler(
|
124
|
+
logger: l.Logger,
|
132
125
|
path: str | path_t,
|
133
126
|
/,
|
134
127
|
*args,
|
135
|
-
logger: lggg.Logger | None = None,
|
136
128
|
name: str | None = None,
|
137
|
-
level: int =
|
129
|
+
level: int = l.INFO,
|
138
130
|
should_store_memory_usage: bool = False,
|
139
131
|
message_width: int = -1,
|
140
|
-
formatter:
|
132
|
+
formatter: l.Formatter | None = None,
|
141
133
|
should_hold_messages: bool = False,
|
142
134
|
**kwargs,
|
143
135
|
) -> None:
|
@@ -146,8 +138,6 @@ def AddFileHandler(
|
|
146
138
|
path = path_t(path)
|
147
139
|
if path.exists():
|
148
140
|
raise ValueError(f"File or folder already exists: {path}.")
|
149
|
-
if logger is None:
|
150
|
-
logger = LOGGER
|
151
141
|
|
152
142
|
handler = file_handler_t(
|
153
143
|
name=name,
|
logger_36/instance/logger.py
CHANGED
logger_36/task/inspection.py
CHANGED
@@ -6,7 +6,7 @@ SEE COPYRIGHT NOTICE BELOW
|
|
6
6
|
|
7
7
|
import importlib.metadata as mprt
|
8
8
|
import pkgutil as pkgs
|
9
|
-
import sys as
|
9
|
+
import sys as s
|
10
10
|
from types import FunctionType, MethodType
|
11
11
|
|
12
12
|
|
@@ -17,8 +17,8 @@ def Modules(
|
|
17
17
|
output = []
|
18
18
|
|
19
19
|
if only_loaded:
|
20
|
-
modules =
|
21
|
-
module_names = set(modules.keys()).difference(
|
20
|
+
modules = s.modules
|
21
|
+
module_names = set(modules.keys()).difference(s.stdlib_module_names)
|
22
22
|
module_names = sorted(module_names, key=str.lower)
|
23
23
|
else:
|
24
24
|
modules = None
|
@@ -22,9 +22,7 @@ def TimeStamp(*, precision: str = "microseconds") -> str:
|
|
22
22
|
)
|
23
23
|
|
24
24
|
|
25
|
-
def ElapsedTime(
|
26
|
-
*, should_return_now: bool = False
|
27
|
-
) -> str | tuple[str, date_time_t]:
|
25
|
+
def ElapsedTime(*, should_return_now: bool = False) -> str | tuple[str, date_time_t]:
|
28
26
|
""""""
|
29
27
|
now = date_time_t.now()
|
30
28
|
elapsed_seconds = (now - _START_DATE_AND_TIME).total_seconds()
|
logger_36/task/storage.py
CHANGED
@@ -5,7 +5,7 @@ SEE COPYRIGHT NOTICE BELOW
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
import dataclasses as d
|
8
|
-
import logging as
|
8
|
+
import logging as l
|
9
9
|
import re as regx
|
10
10
|
from html.parser import HTMLParser as html_parser_t
|
11
11
|
from io import IOBase as io_base_t
|
@@ -16,7 +16,7 @@ try:
|
|
16
16
|
except ModuleNotFoundError:
|
17
17
|
console_t = None
|
18
18
|
|
19
|
-
from logger_36.instance.logger import
|
19
|
+
from logger_36.instance.logger import L
|
20
20
|
|
21
21
|
_BODY_END_PATTERN = r"</[bB][oO][dD][yY]>(.|\n)*$"
|
22
22
|
|
@@ -77,19 +77,19 @@ def SaveLOGasHTML(path: str | path_t | io_base_t | None = None) -> None:
|
|
77
77
|
cannot_save = "Cannot save logging record as HTML"
|
78
78
|
|
79
79
|
if console_t is None:
|
80
|
-
|
80
|
+
L.warning(f"{cannot_save}: The Rich console cannot be imported.")
|
81
81
|
return
|
82
82
|
|
83
83
|
if path is None:
|
84
|
-
for handler in
|
85
|
-
if isinstance(handler,
|
84
|
+
for handler in L.handlers:
|
85
|
+
if isinstance(handler, l.FileHandler):
|
86
86
|
path = path_t(handler.baseFilename).with_suffix(".htm")
|
87
87
|
break
|
88
88
|
if path is None:
|
89
|
-
|
89
|
+
L.warning(f"{cannot_save}: No file handler to build a filename from.")
|
90
90
|
return
|
91
91
|
if path.exists():
|
92
|
-
|
92
|
+
L.warning(
|
93
93
|
f'{cannot_save}: Automatically generated path "{path}" already exists.'
|
94
94
|
)
|
95
95
|
return
|
@@ -98,10 +98,10 @@ def SaveLOGasHTML(path: str | path_t | io_base_t | None = None) -> None:
|
|
98
98
|
|
99
99
|
actual_file = isinstance(path, path_t)
|
100
100
|
if actual_file and path.exists():
|
101
|
-
|
101
|
+
L.warning(f'{cannot_save}: File "{path}" already exists.')
|
102
102
|
return
|
103
103
|
|
104
|
-
for handler in
|
104
|
+
for handler in L.handlers:
|
105
105
|
console = getattr(handler, "console", None)
|
106
106
|
if isinstance(console, console_t) and console.record:
|
107
107
|
html = console.export_html()
|
@@ -112,9 +112,7 @@ def SaveLOGasHTML(path: str | path_t | io_base_t | None = None) -> None:
|
|
112
112
|
path.write(html)
|
113
113
|
break
|
114
114
|
else:
|
115
|
-
|
116
|
-
f"{cannot_save}: No handler has a RICH console with recording ON."
|
117
|
-
)
|
115
|
+
L.warning(f"{cannot_save}: No handler has a RICH console with recording ON.")
|
118
116
|
|
119
117
|
|
120
118
|
"""
|
logger_36/type/handler.py
CHANGED
@@ -5,8 +5,8 @@ SEE COPYRIGHT NOTICE BELOW
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
import dataclasses as d
|
8
|
-
import logging as
|
9
|
-
import sys as
|
8
|
+
import logging as l
|
9
|
+
import sys as s
|
10
10
|
import typing as h
|
11
11
|
|
12
12
|
from logger_36.config.message import (
|
@@ -32,12 +32,12 @@ class handler_extension_t:
|
|
32
32
|
message_width: int = -1
|
33
33
|
MessageFromRecord: h.Callable[..., str] = d.field(init=False)
|
34
34
|
|
35
|
-
handler: d.InitVar[
|
36
|
-
level: d.InitVar[int] =
|
37
|
-
formatter: d.InitVar[
|
35
|
+
handler: d.InitVar[l.Handler | None] = None
|
36
|
+
level: d.InitVar[int] = l.NOTSET
|
37
|
+
formatter: d.InitVar[l.Formatter | None] = None
|
38
38
|
|
39
39
|
def __post_init__(
|
40
|
-
self, handler:
|
40
|
+
self, handler: l.Handler | None, level: int, formatter: l.Formatter | None
|
41
41
|
) -> None:
|
42
42
|
""""""
|
43
43
|
global _MEMORY_MEASURE_ERROR
|
@@ -57,7 +57,7 @@ class handler_extension_t:
|
|
57
57
|
if self.should_store_memory_usage and not CanCheckMemoryUsage():
|
58
58
|
self.should_store_memory_usage = False
|
59
59
|
if _MEMORY_MEASURE_ERROR is not None:
|
60
|
-
print(_MEMORY_MEASURE_ERROR, file=
|
60
|
+
print(_MEMORY_MEASURE_ERROR, file=s.stderr)
|
61
61
|
_MEMORY_MEASURE_ERROR = None
|
62
62
|
|
63
63
|
handler.setLevel(level)
|
@@ -72,7 +72,7 @@ class handler_extension_t:
|
|
72
72
|
|
73
73
|
def _MessageFromRecord(
|
74
74
|
self,
|
75
|
-
record:
|
75
|
+
record: l.LogRecord,
|
76
76
|
/,
|
77
77
|
*,
|
78
78
|
PreProcessed: h.Callable[[str], str] | None = None,
|
logger_36/type/issue.py
CHANGED
@@ -4,7 +4,7 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
|
4
4
|
SEE COPYRIGHT NOTICE BELOW
|
5
5
|
"""
|
6
6
|
|
7
|
-
import logging as
|
7
|
+
import logging as l
|
8
8
|
import typing as h
|
9
9
|
|
10
10
|
from logger_36.config.issue import ISSUE_BASE_CONTEXT
|
@@ -22,7 +22,7 @@ def NewIssue(
|
|
22
22
|
message: str,
|
23
23
|
/,
|
24
24
|
*,
|
25
|
-
level: int =
|
25
|
+
level: int = l.ERROR,
|
26
26
|
actual: h.Any = NOT_PASSED,
|
27
27
|
expected: h.Any | None = None,
|
28
28
|
expected_is_choices: bool = False,
|
logger_36/type/logger.py
CHANGED
@@ -5,8 +5,8 @@ SEE COPYRIGHT NOTICE BELOW
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
import dataclasses as d
|
8
|
-
import logging as
|
9
|
-
import sys as
|
8
|
+
import logging as l
|
9
|
+
import sys as s
|
10
10
|
import traceback as tcbk
|
11
11
|
import types as t
|
12
12
|
import typing as h
|
@@ -39,12 +39,14 @@ from logger_36.constant.record import (
|
|
39
39
|
SHOW_W_RULE_ATTR,
|
40
40
|
STORE_MEMORY_ATTR,
|
41
41
|
)
|
42
|
+
from logger_36.exception import OverrideExceptionFormat
|
43
|
+
from logger_36.handler import AddRichConsoleHandler
|
42
44
|
from logger_36.task.format.message import MessageWithActualExpected
|
43
45
|
from logger_36.task.measure.chronos import ElapsedTime
|
44
46
|
from logger_36.task.measure.memory import CurrentUsage as CurrentMemoryUsage
|
45
47
|
from logger_36.type.issue import NewIssue, issue_t
|
46
48
|
|
47
|
-
logger_base_t =
|
49
|
+
logger_base_t = l.Logger
|
48
50
|
|
49
51
|
_DATE_TIME_ORIGIN = date_time_t.fromtimestamp(1970, None)
|
50
52
|
_DATE_ORIGIN = _DATE_TIME_ORIGIN.date()
|
@@ -56,8 +58,9 @@ class logger_t(logger_base_t):
|
|
56
58
|
intercepted_wrn_handle: When warning interception is on, this stores the original
|
57
59
|
"handle" method of the Python warning logger.
|
58
60
|
"""
|
61
|
+
|
59
62
|
name_: d.InitVar[str] = LOGGER_NAME
|
60
|
-
level_: d.InitVar[int] =
|
63
|
+
level_: d.InitVar[int] = l.NOTSET
|
61
64
|
activate_wrn_interceptions: d.InitVar[bool] = True
|
62
65
|
|
63
66
|
# Must not be False until at least one handler has been added.
|
@@ -65,7 +68,7 @@ class logger_t(logger_base_t):
|
|
65
68
|
exit_on_error: bool = False # Implies exit_on_critical.
|
66
69
|
exit_on_critical: bool = False
|
67
70
|
|
68
|
-
on_hold: list[
|
71
|
+
on_hold: list[l.LogRecord] = d.field(init=False, default_factory=list)
|
69
72
|
events: dict[int, int] = d.field(init=False, default_factory=dict)
|
70
73
|
last_message_now: date_time_t = d.field(init=False, default=_DATE_TIME_ORIGIN)
|
71
74
|
last_message_date: date_t = d.field(init=False, default=_DATE_ORIGIN)
|
@@ -86,7 +89,7 @@ class logger_t(logger_base_t):
|
|
86
89
|
self.setLevel(level_)
|
87
90
|
self.propagate = False # Part of logger_base_t.
|
88
91
|
|
89
|
-
for level in
|
92
|
+
for level in l.getLevelNamesMapping().values():
|
90
93
|
self.events[level] = 0
|
91
94
|
|
92
95
|
if activate_wrn_interceptions:
|
@@ -94,6 +97,11 @@ class logger_t(logger_base_t):
|
|
94
97
|
if self.exit_on_error:
|
95
98
|
self.exit_on_critical = True
|
96
99
|
|
100
|
+
def MakeRich(self, *, alternating_lines: int = 2) -> None:
|
101
|
+
""""""
|
102
|
+
OverrideExceptionFormat()
|
103
|
+
AddRichConsoleHandler(self, alternating_lines=alternating_lines)
|
104
|
+
|
97
105
|
def ResetEventCounts(self) -> None:
|
98
106
|
""""""
|
99
107
|
for level in self.events:
|
@@ -105,21 +113,21 @@ class logger_t(logger_base_t):
|
|
105
113
|
handlers yet.
|
106
114
|
"""
|
107
115
|
if self.intercepted_wrn_handle is None:
|
108
|
-
logger =
|
116
|
+
logger = l.getLogger(WARNING_LOGGER_NAME)
|
109
117
|
self.intercepted_wrn_handle = logger.handle
|
110
118
|
logger.handle = t.MethodType(_HandleForWarnings(self), logger)
|
111
119
|
|
112
|
-
|
120
|
+
l.captureWarnings(True)
|
113
121
|
self.info("Warning Interception: ON")
|
114
122
|
|
115
123
|
def _DeactivateWarningInterceptions(self) -> None:
|
116
124
|
""""""
|
117
125
|
if self.intercepted_wrn_handle is not None:
|
118
|
-
logger =
|
126
|
+
logger = l.getLogger(WARNING_LOGGER_NAME)
|
119
127
|
logger.handle = self.intercepted_wrn_handle
|
120
128
|
self.intercepted_wrn_handle = None
|
121
129
|
|
122
|
-
|
130
|
+
l.captureWarnings(False)
|
123
131
|
self.info("Warning Interception: OFF")
|
124
132
|
|
125
133
|
def ToggleWarningInterceptions(self, state: bool, /) -> None:
|
@@ -134,8 +142,8 @@ class logger_t(logger_base_t):
|
|
134
142
|
if state:
|
135
143
|
self.ToggleLogInterceptions(False)
|
136
144
|
|
137
|
-
all_loggers = [
|
138
|
-
|
145
|
+
all_loggers = [l.getLogger()] + [
|
146
|
+
l.getLogger(_nme)
|
139
147
|
for _nme in self.manager.loggerDict
|
140
148
|
if _nme not in (self.name, WARNING_LOGGER_NAME)
|
141
149
|
]
|
@@ -151,7 +159,7 @@ class logger_t(logger_base_t):
|
|
151
159
|
self.info(f"Now Intercepting LOGs from: {as_str}")
|
152
160
|
elif self.intercepted_log_handles.__len__() > 0:
|
153
161
|
for name, handle in self.intercepted_log_handles.items():
|
154
|
-
logger =
|
162
|
+
logger = l.getLogger(name)
|
155
163
|
logger.handle = handle
|
156
164
|
self.intercepted_log_handles.clear()
|
157
165
|
self.info("Log Interception: OFF")
|
@@ -174,7 +182,7 @@ class logger_t(logger_base_t):
|
|
174
182
|
|
175
183
|
return "?", UNKNOWN_MEMORY_USAGE
|
176
184
|
|
177
|
-
def AddHandler(self, handler:
|
185
|
+
def AddHandler(self, handler: l.Handler, should_hold_messages: bool, /) -> None:
|
178
186
|
""""""
|
179
187
|
self.should_hold_messages = should_hold_messages
|
180
188
|
logger_base_t.addHandler(self, handler)
|
@@ -195,10 +203,10 @@ class logger_t(logger_base_t):
|
|
195
203
|
|
196
204
|
self.info(
|
197
205
|
f'New handler "{name}" of type "{type(handler).__name__}" and '
|
198
|
-
f"level {handler.level}={
|
206
|
+
f"level {handler.level}={l.getLevelName(handler.level)}{path}",
|
199
207
|
)
|
200
208
|
|
201
|
-
def handle(self, record:
|
209
|
+
def handle(self, record: l.LogRecord, /) -> None:
|
202
210
|
""""""
|
203
211
|
elapsed_time, now = ElapsedTime(should_return_now=True)
|
204
212
|
|
@@ -210,10 +218,10 @@ class logger_t(logger_base_t):
|
|
210
218
|
if (date := now.date()) != self.last_message_date:
|
211
219
|
self.last_message_date = date
|
212
220
|
# levelno: Added for management by logging.Logger.handle.
|
213
|
-
date_record =
|
221
|
+
date_record = l.makeLogRecord(
|
214
222
|
{
|
215
223
|
"name": self.name,
|
216
|
-
"levelno":
|
224
|
+
"levelno": l.INFO,
|
217
225
|
"msg": f"DATE: {date.strftime(DATE_FORMAT)}",
|
218
226
|
SHOW_W_RULE_ATTR: True,
|
219
227
|
}
|
@@ -235,12 +243,12 @@ class logger_t(logger_base_t):
|
|
235
243
|
# Where.
|
236
244
|
# Memory usage is also stored if there are no handlers yet, just in case.
|
237
245
|
should_store_where = self.any_handler_stores_memory or not self.hasHandlers()
|
238
|
-
should_show_where = (record.levelno !=
|
246
|
+
should_show_where = (record.levelno != l.INFO) and not hasattr(
|
239
247
|
record, HIDE_WHERE_ATTR
|
240
248
|
)
|
241
249
|
if should_store_where or should_show_where:
|
242
250
|
module = path_t(record.pathname)
|
243
|
-
for path in
|
251
|
+
for path in s.path:
|
244
252
|
if module.is_relative_to(path):
|
245
253
|
module = module.relative_to(path).with_suffix("")
|
246
254
|
module = str(module).replace(FOLDER_SEPARATOR, ".")
|
@@ -265,12 +273,12 @@ class logger_t(logger_base_t):
|
|
265
273
|
else:
|
266
274
|
logger_base_t.handle(self, record)
|
267
275
|
|
268
|
-
if (self.exit_on_critical and (record.levelno is
|
269
|
-
self.exit_on_error and (record.levelno is
|
276
|
+
if (self.exit_on_critical and (record.levelno is l.CRITICAL)) or (
|
277
|
+
self.exit_on_error and (record.levelno is l.ERROR)
|
270
278
|
):
|
271
|
-
# Also works if self.exit_on_error and record.levelno is
|
279
|
+
# Also works if self.exit_on_error and record.levelno is l.CRITICAL since
|
272
280
|
# __post_init__ set self.exit_on_critical if self.exit_on_error.
|
273
|
-
|
281
|
+
s.exit(1)
|
274
282
|
|
275
283
|
self.events[record.levelno] += 1
|
276
284
|
|
@@ -282,7 +290,7 @@ class logger_t(logger_base_t):
|
|
282
290
|
message: str,
|
283
291
|
/,
|
284
292
|
*,
|
285
|
-
level: int | str =
|
293
|
+
level: int | str = l.ERROR,
|
286
294
|
actual: h.Any = NOT_PASSED,
|
287
295
|
expected: h.Any | None = None,
|
288
296
|
expected_is_choices: bool = False,
|
@@ -291,7 +299,7 @@ class logger_t(logger_base_t):
|
|
291
299
|
) -> None:
|
292
300
|
""""""
|
293
301
|
if isinstance(level, str):
|
294
|
-
level =
|
302
|
+
level = l.getLevelNamesMapping()[level.upper()]
|
295
303
|
message = MessageWithActualExpected(
|
296
304
|
message,
|
297
305
|
actual=actual,
|
@@ -307,12 +315,12 @@ class logger_t(logger_base_t):
|
|
307
315
|
exception: Exception,
|
308
316
|
/,
|
309
317
|
*,
|
310
|
-
level: int | str =
|
318
|
+
level: int | str = l.ERROR,
|
311
319
|
should_remove_caller: bool = False,
|
312
320
|
) -> None:
|
313
321
|
""""""
|
314
322
|
if isinstance(level, str):
|
315
|
-
level =
|
323
|
+
level = l.getLevelNamesMapping()[level.upper()]
|
316
324
|
lines = tcbk.format_exception(exception)
|
317
325
|
if should_remove_caller:
|
318
326
|
message = "\n".join(lines[:1] + lines[2:])
|
@@ -359,7 +367,7 @@ class logger_t(logger_base_t):
|
|
359
367
|
message: str,
|
360
368
|
/,
|
361
369
|
*,
|
362
|
-
level: int =
|
370
|
+
level: int = l.ERROR,
|
363
371
|
actual: h.Any = NOT_PASSED,
|
364
372
|
expected: h.Any | None = None,
|
365
373
|
expected_is_choices: bool = False,
|
@@ -457,7 +465,7 @@ class logger_t(logger_base_t):
|
|
457
465
|
def _HandleForWarnings(interceptor: logger_base_t, /) -> logger_handle_h:
|
458
466
|
""""""
|
459
467
|
|
460
|
-
def handle_p(_: logger_base_t, record:
|
468
|
+
def handle_p(_: logger_base_t, record: l.LogRecord, /) -> None:
|
461
469
|
pieces = WARNING_TYPE_COMPILED_PATTERN.match(record.msg)
|
462
470
|
if pieces is None:
|
463
471
|
# The warning message does not follow the default format.
|
@@ -470,7 +478,7 @@ def _HandleForWarnings(interceptor: logger_base_t, /) -> logger_handle_h:
|
|
470
478
|
kind = GetPiece(3)
|
471
479
|
message = GetPiece(4).strip()
|
472
480
|
|
473
|
-
duplicate =
|
481
|
+
duplicate = l.makeLogRecord(record.__dict__)
|
474
482
|
duplicate.msg = f"{kind}: {message}"
|
475
483
|
duplicate.pathname = path
|
476
484
|
duplicate.module = path_t(path).stem
|
@@ -487,8 +495,8 @@ def _HandleForInterceptions(
|
|
487
495
|
) -> logger_handle_h:
|
488
496
|
""""""
|
489
497
|
|
490
|
-
def handle_p(_: logger_base_t, record:
|
491
|
-
duplicate =
|
498
|
+
def handle_p(_: logger_base_t, record: l.LogRecord, /) -> None:
|
499
|
+
duplicate = l.makeLogRecord(record.__dict__)
|
492
500
|
duplicate.msg = f"{record.msg} :{intercepted.name}:"
|
493
501
|
interceptor.handle(duplicate)
|
494
502
|
|
logger_36/version.py
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
logger_36/__init__.py,sha256=
|
1
|
+
logger_36/__init__.py,sha256=3BtAgxFb14e9zzC5fXwqSQxstsd3BO0b_KVu3_wbLwg,2592
|
2
2
|
logger_36/content.py,sha256=ni9gdYYNZoDa91KNianWBluOBe9KxZMZtzalcBS6vhE,2357
|
3
|
-
logger_36/exception.py,sha256=
|
3
|
+
logger_36/exception.py,sha256=CDHwCeILgCq8Z9IF0xDwd37wTczxFUTUSngtO0RCs00,3415
|
4
4
|
logger_36/gpu.py,sha256=YYFk6aYQrBDJfxQaDm-ar16T6SlOSL6jJWTOgvpF4EU,2244
|
5
|
-
logger_36/handler.py,sha256=
|
5
|
+
logger_36/handler.py,sha256=Lle0eHQGXw86kDKhFPAsbc6VTtKAGBRY3NbgRwb22D0,6242
|
6
6
|
logger_36/memory.py,sha256=FTc3qCeMqnCNvHJ4Yds73noPENQx_U1MYB-R4LLUjVQ,2682
|
7
7
|
logger_36/storage.py,sha256=TNfIXEfHcjixv75wocUyqwX62iDYsor4srRqC3FNzbc,2231
|
8
8
|
logger_36/system.py,sha256=xzm6cMeTaCX9VX9ZRXUXgfqoT9oUtv3W2o_H2W0P-4Q,2243
|
9
9
|
logger_36/time.py,sha256=_CtpQeUZdsUNGNfwzhoWUiUvawRgmonqwZPHouzWf5M,2308
|
10
|
-
logger_36/version.py,sha256=
|
10
|
+
logger_36/version.py,sha256=fGumU_oHdColabh0PPq2BbbOtvjiaBGJGm7CfodTKq8,2205
|
11
11
|
logger_36/api/logger.py,sha256=Wg2nzQeuRVZ4v-oy3Q2KdYsHSzF9v7a0Fk6BzLnbkYw,2225
|
12
12
|
logger_36/api/storage.py,sha256=evKVqIsslA5X82LaZ2HQDxp7ltyNOn8Tr-3-Pic3eUo,2231
|
13
|
-
logger_36/catalog/config/console_rich.py,sha256=
|
14
|
-
logger_36/catalog/handler/console.py,sha256=
|
15
|
-
logger_36/catalog/handler/console_rich.py,sha256=
|
16
|
-
logger_36/catalog/handler/file.py,sha256=
|
17
|
-
logger_36/catalog/handler/generic.py,sha256=
|
18
|
-
logger_36/catalog/logger/chronos.py,sha256=
|
19
|
-
logger_36/catalog/logger/gpu.py,sha256=
|
20
|
-
logger_36/catalog/logger/memory.py,sha256=
|
21
|
-
logger_36/catalog/logger/system.py,sha256=
|
13
|
+
logger_36/catalog/config/console_rich.py,sha256=hp2r1bsT_Zj4c-IzL6-sPQKe0yrIKUX7IxseK-znXTo,2845
|
14
|
+
logger_36/catalog/handler/console.py,sha256=glrpWsmZsB7uZdQA0HLSKGGIz6OrvhOOiJp5XRibBNU,4226
|
15
|
+
logger_36/catalog/handler/console_rich.py,sha256=09xd50E8REu2iFtTNj0rYJfUFVxBzneqwWTmSYquiM0,8355
|
16
|
+
logger_36/catalog/handler/file.py,sha256=C6x58N2asQ4LDBTKyNBBOlIs719FeVg80PsaDjlDg04,4690
|
17
|
+
logger_36/catalog/handler/generic.py,sha256=LE2_aEMjM2sjoPN9i7E0OEulKt6f-SYAoqYZ_ugVnZc,9123
|
18
|
+
logger_36/catalog/logger/chronos.py,sha256=ocY13f98EfknU7wZCv0FS9Xb7pTNaWCPSusXFIEvEd4,2437
|
19
|
+
logger_36/catalog/logger/gpu.py,sha256=dw1eiEJurjXZBE1EhrHHR2LJbcHZ9sUSB9Z_SoJk2Ts,3407
|
20
|
+
logger_36/catalog/logger/memory.py,sha256=CWhr2J4BqArJxzH6tS-ZThr-rYPAQGtuLn0pP7Iryfg,4685
|
21
|
+
logger_36/catalog/logger/system.py,sha256=KXP2jdPd-ACFNdA0wWdmOLwuxt4baUvXkuChyOHyfy0,3066
|
22
22
|
logger_36/config/issue.py,sha256=G-i5p6lhZCLAOa-VTMyL9ZonvGCvhdoQ5KZdSWgP-FU,2267
|
23
|
-
logger_36/config/logger.py,sha256=
|
23
|
+
logger_36/config/logger.py,sha256=Iiox_X1N2Ty73N-Ao0XI6dsBebXqvZd0efP3h1txYjc,3691
|
24
24
|
logger_36/config/memory.py,sha256=yCX5phsB_KJMr5xHpVUeOHFhAA7p_8yahP3X28VndOY,2217
|
25
25
|
logger_36/config/message.py,sha256=yfbMO_Jk1IbWvT6Lp6hVpID2Tr99cuiJ-ZaMBesIFXw,2527
|
26
26
|
logger_36/config/system.py,sha256=HD8ZuwsXhEAExeZrww8YoDkQGMs4T5RDqQMb1W4qVgc,2477
|
@@ -28,25 +28,25 @@ logger_36/constant/error.py,sha256=1gdnCwUu3d3ThL4AKxzjn7ijSTBWlr2g-8cAKbubl4A,2
|
|
28
28
|
logger_36/constant/generic.py,sha256=t6aRb66_NHwMhR1p7BZ4QXTU2jpLz-H5YAL4PuMtKx8,2244
|
29
29
|
logger_36/constant/handler.py,sha256=cBf_bPB9fceCuIpzmqj345vaas-kx17YRO-rFF3Cvms,2338
|
30
30
|
logger_36/constant/issue.py,sha256=01l8itRPWGS5F6gXtsXUJgGR-4lS1Eu3_YeKC-khKLw,2315
|
31
|
-
logger_36/constant/logger.py,sha256=
|
31
|
+
logger_36/constant/logger.py,sha256=yorhAOTQTlIKE_51LZUhXfehrBAPfiPRJ5qJ4NA4GP8,2664
|
32
32
|
logger_36/constant/memory.py,sha256=ZL1MwbdtNsrCrOwzEyfTsfOoOsRBTJtbbf3otHGnxXo,2343
|
33
33
|
logger_36/constant/message.py,sha256=Ys_CAyhENlT8Z3rr-AxO4hjdl1jLsKzVSPQ8wqLOCPQ,2838
|
34
34
|
logger_36/constant/record.py,sha256=9Q28lVH_s0og4v74delgwIPAJ9G28I5rBM-brXcoY80,2308
|
35
35
|
logger_36/constant/system.py,sha256=G2mzBTxRXoJMxb53TnmBaceMJC_q3WonoCG7y6nC_R8,2430
|
36
|
-
logger_36/instance/logger.py,sha256=
|
36
|
+
logger_36/instance/logger.py,sha256=oTw5svRzKRJKvGrrZUtutJIOjp5UISft3fl0Ze7DOBE,2241
|
37
37
|
logger_36/instance/loggers.py,sha256=RCWpC1NPAf6vXnFc9NqsSALv-x-FEzcH6k_OlxTxeQk,2251
|
38
|
-
logger_36/task/inspection.py,sha256=
|
39
|
-
logger_36/task/storage.py,sha256=
|
38
|
+
logger_36/task/inspection.py,sha256=KZzmQyREQ6VmBWCLyNIYIOOISW9C_fC9TWTSX90zGDk,5019
|
39
|
+
logger_36/task/storage.py,sha256=33Fz-7Isko_e6z9Ig9IkgDJ-NQKgkPhI4Pw3w6IlH1E,5632
|
40
40
|
logger_36/task/format/memory.py,sha256=jpQS8tAdxy7GM_FzqEIJUU3m-6O9iX-jiyO7gx5YwR8,4266
|
41
41
|
logger_36/task/format/message.py,sha256=T2V2gUlUQqSojyRrz4I4uAHwNe6eBEsuAe6V-LTyx0k,3867
|
42
42
|
logger_36/task/format/rule.py,sha256=OjNZQa_dZrH4Vhide6xm3EuV0lLC6tR1Q2_ZAxD7ito,2813
|
43
|
-
logger_36/task/measure/chronos.py,sha256=
|
43
|
+
logger_36/task/measure/chronos.py,sha256=1kVhu6jZlNAtNWQQh8ZVuRwZIAC9gGz3_ul1tn0t4Yw,3055
|
44
44
|
logger_36/task/measure/memory.py,sha256=-V9UDFlDwmtUlfBzovcMgmsaYxwyoE1YmfXjXZ2iuNc,2512
|
45
|
-
logger_36/type/handler.py,sha256=
|
46
|
-
logger_36/type/issue.py,sha256=
|
47
|
-
logger_36/type/logger.py,sha256=
|
45
|
+
logger_36/type/handler.py,sha256=_cmOyF48nMTMUspSGH-Z1iil5AzEBW9wcEeTfC8lld8,6447
|
46
|
+
logger_36/type/issue.py,sha256=2rGsFqaQJCbeml9xN08mN_nK79L8qscaS_0ws36Y0bI,3214
|
47
|
+
logger_36/type/logger.py,sha256=7NI6P5VkjMVdpirEMqIAhVADh-nOpKmKgDgHOqDSF4k,19332
|
48
48
|
logger_36/type/loggers.py,sha256=znqxWBnfQxvkg3VUfbTUvt3S6Kq0DAzWWepxQDt9suI,2871
|
49
|
-
logger_36-2025.
|
50
|
-
logger_36-2025.
|
51
|
-
logger_36-2025.
|
52
|
-
logger_36-2025.
|
49
|
+
logger_36-2025.5.dist-info/METADATA,sha256=5nalYzhNdZDZoLfFlrBBRzRkLbnBR7U7mVqcfl_vQDs,6505
|
50
|
+
logger_36-2025.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
51
|
+
logger_36-2025.5.dist-info/top_level.txt,sha256=sM95BTMWmslEEgR_1pzwZsOeSp8C_QBiu8ImbFr0XLc,10
|
52
|
+
logger_36-2025.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|