logger-36 2024.23__py3-none-any.whl → 2024.25__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 +0 -1
- logger_36/api/logger.py +53 -0
- logger_36/api/storage.py +53 -0
- logger_36/catalog/handler/console_rich.py +5 -4
- logger_36/content.py +54 -0
- logger_36/exception.py +98 -0
- logger_36/{format.py → memory.py} +3 -2
- logger_36/storage.py +1 -1
- logger_36/{logger.py → system.py} +0 -2
- logger_36/task/format/message.py +1 -10
- logger_36/task/format/rule.py +10 -4
- logger_36/task/measure/chronos.py +2 -7
- logger_36/{measure.py → time.py} +1 -2
- logger_36/type/logger.py +34 -14
- logger_36/version.py +1 -1
- {logger_36-2024.23.dist-info → logger_36-2024.25.dist-info}/METADATA +1 -1
- {logger_36-2024.23.dist-info → logger_36-2024.25.dist-info}/RECORD +20 -16
- {logger_36-2024.23.dist-info → logger_36-2024.25.dist-info}/WHEEL +1 -1
- /logger_36/{logger_gpu.py → gpu.py} +0 -0
- {logger_36-2024.23.dist-info → logger_36-2024.25.dist-info}/top_level.txt +0 -0
logger_36/__init__.py
CHANGED
logger_36/api/logger.py
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
6
|
+
|
7
|
+
from logger_36.type.logger import logger_t
|
8
|
+
|
9
|
+
"""
|
10
|
+
COPYRIGHT NOTICE
|
11
|
+
|
12
|
+
This software is governed by the CeCILL license under French law and
|
13
|
+
abiding by the rules of distribution of free software. You can use,
|
14
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
15
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
16
|
+
"http://www.cecill.info".
|
17
|
+
|
18
|
+
As a counterpart to the access to the source code and rights to copy,
|
19
|
+
modify and redistribute granted by the license, users are provided only
|
20
|
+
with a limited warranty and the software's author, the holder of the
|
21
|
+
economic rights, and the successive licensors have only limited
|
22
|
+
liability.
|
23
|
+
|
24
|
+
In this respect, the user's attention is drawn to the risks associated
|
25
|
+
with loading, using, modifying and/or developing or reproducing the
|
26
|
+
software by the user in light of its specific status of free software,
|
27
|
+
that may mean that it is complicated to manipulate, and that also
|
28
|
+
therefore means that it is reserved for developers and experienced
|
29
|
+
professionals having in-depth computer knowledge. Users are therefore
|
30
|
+
encouraged to load and test the software's suitability as regards their
|
31
|
+
requirements in conditions enabling the security of their systems and/or
|
32
|
+
data to be ensured and, more generally, to use and operate it in the
|
33
|
+
same conditions as regards security.
|
34
|
+
|
35
|
+
The fact that you are presently reading this means that you have had
|
36
|
+
knowledge of the CeCILL license and that you accept its terms.
|
37
|
+
|
38
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
39
|
+
|
40
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
41
|
+
member of team Morpheme.
|
42
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
43
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
44
|
+
I3S, and Laboratory iBV.
|
45
|
+
|
46
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
47
|
+
Inria: https://www.inria.fr/en/
|
48
|
+
UniCA: https://univ-cotedazur.eu/
|
49
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
50
|
+
I3S: https://www.i3s.unice.fr/en/
|
51
|
+
iBV: http://ibv.unice.fr/
|
52
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
53
|
+
"""
|
logger_36/api/storage.py
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
6
|
+
|
7
|
+
from logger_36.task.storage import html_reader_t
|
8
|
+
|
9
|
+
"""
|
10
|
+
COPYRIGHT NOTICE
|
11
|
+
|
12
|
+
This software is governed by the CeCILL license under French law and
|
13
|
+
abiding by the rules of distribution of free software. You can use,
|
14
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
15
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
16
|
+
"http://www.cecill.info".
|
17
|
+
|
18
|
+
As a counterpart to the access to the source code and rights to copy,
|
19
|
+
modify and redistribute granted by the license, users are provided only
|
20
|
+
with a limited warranty and the software's author, the holder of the
|
21
|
+
economic rights, and the successive licensors have only limited
|
22
|
+
liability.
|
23
|
+
|
24
|
+
In this respect, the user's attention is drawn to the risks associated
|
25
|
+
with loading, using, modifying and/or developing or reproducing the
|
26
|
+
software by the user in light of its specific status of free software,
|
27
|
+
that may mean that it is complicated to manipulate, and that also
|
28
|
+
therefore means that it is reserved for developers and experienced
|
29
|
+
professionals having in-depth computer knowledge. Users are therefore
|
30
|
+
encouraged to load and test the software's suitability as regards their
|
31
|
+
requirements in conditions enabling the security of their systems and/or
|
32
|
+
data to be ensured and, more generally, to use and operate it in the
|
33
|
+
same conditions as regards security.
|
34
|
+
|
35
|
+
The fact that you are presently reading this means that you have had
|
36
|
+
knowledge of the CeCILL license and that you accept its terms.
|
37
|
+
|
38
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
39
|
+
|
40
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
41
|
+
member of team Morpheme.
|
42
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
43
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
44
|
+
I3S, and Laboratory iBV.
|
45
|
+
|
46
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
47
|
+
Inria: https://www.inria.fr/en/
|
48
|
+
UniCA: https://univ-cotedazur.eu/
|
49
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
50
|
+
I3S: https://www.i3s.unice.fr/en/
|
51
|
+
iBV: http://ibv.unice.fr/
|
52
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
53
|
+
"""
|
@@ -31,7 +31,6 @@ from logger_36.task.format.rule import Rule
|
|
31
31
|
from logger_36.type.handler import handler_extension_t
|
32
32
|
from rich.console import Console as console_t
|
33
33
|
from rich.console import RenderableType as renderable_t
|
34
|
-
from rich.markup import escape as EscapedForRich
|
35
34
|
from rich.text import Text as text_t
|
36
35
|
from rich.traceback import install as InstallTracebackHandler
|
37
36
|
|
@@ -140,7 +139,7 @@ class console_rich_handler_t(lggg.Handler):
|
|
140
139
|
if hasattr(record, SHOW_W_RULE_ATTR):
|
141
140
|
richer = Rule(record.msg, DATE_TIME_COLOR)
|
142
141
|
else:
|
143
|
-
first, next_s = self.FormattedLines(record
|
142
|
+
first, next_s = self.FormattedLines(record)
|
144
143
|
should_highlight_back = self.alternating_lines == 1
|
145
144
|
if self.alternating_lines >= 0:
|
146
145
|
self.alternating_lines = (self.alternating_lines + 1) % 2
|
@@ -173,7 +172,9 @@ def HighlightedVersion(
|
|
173
172
|
background_is_light: bool = True,
|
174
173
|
) -> renderable_t:
|
175
174
|
""""""
|
176
|
-
|
175
|
+
# TODO: Is there a way to use html or something to enable message styling,
|
176
|
+
# regardless of the handler (would require styling conversion; html->rich here).
|
177
|
+
output = text_t.from_markup(first_line)
|
177
178
|
|
178
179
|
# Used instead of _CONTEXT_LENGTH which might include \t, thus creating a
|
179
180
|
# mismatch between character length and length when displayed in console.
|
@@ -193,7 +194,7 @@ def HighlightedVersion(
|
|
193
194
|
output.stylize(ELAPSED_TIME_COLOR, start=elapsed_time_separator)
|
194
195
|
|
195
196
|
if next_lines is not None:
|
196
|
-
output.append(next_lines)
|
197
|
+
output.append(text_t.from_markup(next_lines))
|
197
198
|
|
198
199
|
_ = output.highlight_regex(ACTUAL_PATTERNS, style=ACTUAL_COLOR)
|
199
200
|
_ = output.highlight_regex(EXPECTED_PATTERNS, style=EXPECTED_COLOR)
|
logger_36/content.py
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
6
|
+
|
7
|
+
from logger_36.task.format.message import FormattedMessage
|
8
|
+
from logger_36.task.format.rule import Rule, RuleAsText
|
9
|
+
|
10
|
+
"""
|
11
|
+
COPYRIGHT NOTICE
|
12
|
+
|
13
|
+
This software is governed by the CeCILL license under French law and
|
14
|
+
abiding by the rules of distribution of free software. You can use,
|
15
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
16
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
17
|
+
"http://www.cecill.info".
|
18
|
+
|
19
|
+
As a counterpart to the access to the source code and rights to copy,
|
20
|
+
modify and redistribute granted by the license, users are provided only
|
21
|
+
with a limited warranty and the software's author, the holder of the
|
22
|
+
economic rights, and the successive licensors have only limited
|
23
|
+
liability.
|
24
|
+
|
25
|
+
In this respect, the user's attention is drawn to the risks associated
|
26
|
+
with loading, using, modifying and/or developing or reproducing the
|
27
|
+
software by the user in light of its specific status of free software,
|
28
|
+
that may mean that it is complicated to manipulate, and that also
|
29
|
+
therefore means that it is reserved for developers and experienced
|
30
|
+
professionals having in-depth computer knowledge. Users are therefore
|
31
|
+
encouraged to load and test the software's suitability as regards their
|
32
|
+
requirements in conditions enabling the security of their systems and/or
|
33
|
+
data to be ensured and, more generally, to use and operate it in the
|
34
|
+
same conditions as regards security.
|
35
|
+
|
36
|
+
The fact that you are presently reading this means that you have had
|
37
|
+
knowledge of the CeCILL license and that you accept its terms.
|
38
|
+
|
39
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
40
|
+
|
41
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
42
|
+
member of team Morpheme.
|
43
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
44
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
45
|
+
I3S, and Laboratory iBV.
|
46
|
+
|
47
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
48
|
+
Inria: https://www.inria.fr/en/
|
49
|
+
UniCA: https://univ-cotedazur.eu/
|
50
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
51
|
+
I3S: https://www.i3s.unice.fr/en/
|
52
|
+
iBV: http://ibv.unice.fr/
|
53
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
54
|
+
"""
|
logger_36/exception.py
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
"""
|
2
|
+
Copyright CNRS/Inria/UniCA
|
3
|
+
Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
4
|
+
SEE COPYRIGHT NOTICE BELOW
|
5
|
+
"""
|
6
|
+
|
7
|
+
import sys as sstm
|
8
|
+
import tempfile as tmpf
|
9
|
+
import traceback as tcbk
|
10
|
+
import types as t
|
11
|
+
|
12
|
+
_ORIGINAL_EXCEPTION_HANDLER = sstm.excepthook
|
13
|
+
|
14
|
+
|
15
|
+
def OverrideExceptionFormat() -> None:
|
16
|
+
""""""
|
17
|
+
sstm.excepthook = _HandleException
|
18
|
+
|
19
|
+
|
20
|
+
def ResetExceptionFormat() -> None:
|
21
|
+
""""""
|
22
|
+
sstm.excepthook = _ORIGINAL_EXCEPTION_HANDLER
|
23
|
+
|
24
|
+
|
25
|
+
def _HandleException(
|
26
|
+
stripe: type[Exception], exception: Exception, trace: t.TracebackType, /
|
27
|
+
) -> None:
|
28
|
+
""""""
|
29
|
+
while trace.tb_next is not None:
|
30
|
+
trace = trace.tb_next
|
31
|
+
frame = trace.tb_frame
|
32
|
+
module = frame.f_code.co_filename
|
33
|
+
function = frame.f_code.co_name
|
34
|
+
line = frame.f_lineno
|
35
|
+
|
36
|
+
message = str(exception)
|
37
|
+
if message.__len__() > 0:
|
38
|
+
message = f" {message}\n"
|
39
|
+
|
40
|
+
document = tmpf.NamedTemporaryFile(delete=False)
|
41
|
+
|
42
|
+
print(
|
43
|
+
f"{stripe.__name__}\n {module}.{function}@{line}\n{message} Full report at: {document.name}",
|
44
|
+
file=sstm.stderr,
|
45
|
+
)
|
46
|
+
|
47
|
+
lines = tcbk.format_exception(exception)
|
48
|
+
message = "".join(lines)
|
49
|
+
|
50
|
+
document.write(message.encode())
|
51
|
+
document.close()
|
52
|
+
|
53
|
+
|
54
|
+
"""
|
55
|
+
COPYRIGHT NOTICE
|
56
|
+
|
57
|
+
This software is governed by the CeCILL license under French law and
|
58
|
+
abiding by the rules of distribution of free software. You can use,
|
59
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
60
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
61
|
+
"http://www.cecill.info".
|
62
|
+
|
63
|
+
As a counterpart to the access to the source code and rights to copy,
|
64
|
+
modify and redistribute granted by the license, users are provided only
|
65
|
+
with a limited warranty and the software's author, the holder of the
|
66
|
+
economic rights, and the successive licensors have only limited
|
67
|
+
liability.
|
68
|
+
|
69
|
+
In this respect, the user's attention is drawn to the risks associated
|
70
|
+
with loading, using, modifying and/or developing or reproducing the
|
71
|
+
software by the user in light of its specific status of free software,
|
72
|
+
that may mean that it is complicated to manipulate, and that also
|
73
|
+
therefore means that it is reserved for developers and experienced
|
74
|
+
professionals having in-depth computer knowledge. Users are therefore
|
75
|
+
encouraged to load and test the software's suitability as regards their
|
76
|
+
requirements in conditions enabling the security of their systems and/or
|
77
|
+
data to be ensured and, more generally, to use and operate it in the
|
78
|
+
same conditions as regards security.
|
79
|
+
|
80
|
+
The fact that you are presently reading this means that you have had
|
81
|
+
knowledge of the CeCILL license and that you accept its terms.
|
82
|
+
|
83
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
84
|
+
|
85
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
86
|
+
member of team Morpheme.
|
87
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
88
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
89
|
+
I3S, and Laboratory iBV.
|
90
|
+
|
91
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
92
|
+
Inria: https://www.inria.fr/en/
|
93
|
+
UniCA: https://univ-cotedazur.eu/
|
94
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
95
|
+
I3S: https://www.i3s.unice.fr/en/
|
96
|
+
iBV: http://ibv.unice.fr/
|
97
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
98
|
+
"""
|
@@ -4,13 +4,14 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
|
4
4
|
SEE COPYRIGHT NOTICE BELOW
|
5
5
|
"""
|
6
6
|
|
7
|
+
from logger_36.catalog.logger.memory import LogMaximumMemoryUsage, LogMemoryUsages
|
7
8
|
from logger_36.task.format.memory import FormattedUsage as FormattedMemoryUsage
|
8
9
|
from logger_36.task.format.memory import (
|
9
10
|
FormattedUsageWithAutoUnit as FormattedMemoryUsageWithAutoUnit,
|
10
11
|
)
|
11
12
|
from logger_36.task.format.memory import UsageBar as MemoryUsageBar
|
12
|
-
from logger_36.task.
|
13
|
-
from logger_36.task.
|
13
|
+
from logger_36.task.measure.memory import CanCheckUsage as CanCheckMemoryUsage
|
14
|
+
from logger_36.task.measure.memory import CurrentUsage as CurrentMemoryUsage
|
14
15
|
|
15
16
|
"""
|
16
17
|
COPYRIGHT NOTICE
|
logger_36/storage.py
CHANGED
@@ -4,8 +4,6 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
|
4
4
|
SEE COPYRIGHT NOTICE BELOW
|
5
5
|
"""
|
6
6
|
|
7
|
-
from logger_36.catalog.logger.chronos import LogElapsedTime
|
8
|
-
from logger_36.catalog.logger.memory import LogMaximumMemoryUsage, LogMemoryUsages
|
9
7
|
from logger_36.catalog.logger.system import LogSystemDetails
|
10
8
|
|
11
9
|
"""
|
logger_36/task/format/message.py
CHANGED
@@ -15,7 +15,7 @@ from logger_36.config.message import (
|
|
15
15
|
MESSAGE_MARKER,
|
16
16
|
)
|
17
17
|
from logger_36.constant.generic import NOT_PASSED
|
18
|
-
from logger_36.constant.message import
|
18
|
+
from logger_36.constant.message import expected_op_h
|
19
19
|
|
20
20
|
|
21
21
|
def MessageFormat(with_where: bool, with_memory_usage: bool, /) -> str:
|
@@ -46,15 +46,6 @@ def FormattedMessage(
|
|
46
46
|
with_final_dot: bool = True,
|
47
47
|
) -> str:
|
48
48
|
""""""
|
49
|
-
if expected_op not in EXPECTED_OP:
|
50
|
-
raise ValueError(
|
51
|
-
FormattedMessage(
|
52
|
-
'Invalid "expected" section operator',
|
53
|
-
actual=expected_op,
|
54
|
-
expected=f"One of {str(EXPECTED_OP)[1:-1]}",
|
55
|
-
)
|
56
|
-
)
|
57
|
-
|
58
49
|
if actual is NOT_PASSED:
|
59
50
|
if with_final_dot:
|
60
51
|
if message[-1] != ".":
|
logger_36/task/format/rule.py
CHANGED
@@ -5,18 +5,24 @@ SEE COPYRIGHT NOTICE BELOW
|
|
5
5
|
"""
|
6
6
|
|
7
7
|
|
8
|
-
def RuleAsText(text: str, /) -> str:
|
8
|
+
def RuleAsText(text: str | None, /) -> str:
|
9
9
|
""""""
|
10
|
-
|
10
|
+
if text is None:
|
11
|
+
return "---- ---- ---- ---- ---- ---- ---- ---- ----"
|
12
|
+
else:
|
13
|
+
return f"---- ---- ---- ---- {text} ---- ---- ---- ----"
|
11
14
|
|
12
15
|
|
13
16
|
try:
|
14
17
|
from rich.rule import Rule as rule_t
|
15
18
|
from rich.text import Text as text_t
|
16
19
|
|
17
|
-
def Rule(text: str, color: str, /) -> rule_t:
|
20
|
+
def Rule(text: str | None, color: str, /) -> rule_t | str:
|
18
21
|
""""""
|
19
|
-
|
22
|
+
if text is None:
|
23
|
+
return rule_t(style=color)
|
24
|
+
else:
|
25
|
+
return rule_t(title=text_t(text, style=f"bold {color}"), style=color)
|
20
26
|
|
21
27
|
except ModuleNotFoundError:
|
22
28
|
Rule = lambda _txt, _: RuleAsText(_txt)
|
@@ -12,14 +12,9 @@ from datetime import datetime as dttm
|
|
12
12
|
_START_DATE_AND_TIME = dttm.now()
|
13
13
|
|
14
14
|
|
15
|
-
def TimeStamp() -> str:
|
15
|
+
def TimeStamp(*, precision: str = "microseconds") -> str:
|
16
16
|
""""""
|
17
|
-
return (
|
18
|
-
dttm.now()
|
19
|
-
.isoformat(timespec="milliseconds")
|
20
|
-
.replace(".", "-")
|
21
|
-
.replace(":", "-")
|
22
|
-
)
|
17
|
+
return dttm.now().isoformat(timespec=precision).replace(".", "-").replace(":", "-")
|
23
18
|
|
24
19
|
|
25
20
|
def ElapsedTime() -> str:
|
logger_36/{measure.py → time.py}
RENAMED
@@ -4,9 +4,8 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
|
4
4
|
SEE COPYRIGHT NOTICE BELOW
|
5
5
|
"""
|
6
6
|
|
7
|
+
from logger_36.catalog.logger.chronos import LogElapsedTime
|
7
8
|
from logger_36.task.measure.chronos import ElapsedTime, TimeStamp
|
8
|
-
from logger_36.task.measure.memory import CanCheckUsage as CanCheckMemoryUsage
|
9
|
-
from logger_36.task.measure.memory import CurrentUsage as CurrentMemoryUsage
|
10
9
|
|
11
10
|
"""
|
12
11
|
COPYRIGHT NOTICE
|
logger_36/type/logger.py
CHANGED
@@ -32,6 +32,7 @@ from logger_36.task.format.memory import (
|
|
32
32
|
FormattedUsageWithAutoUnit as FormattedMemoryUsage,
|
33
33
|
)
|
34
34
|
from logger_36.task.format.message import FormattedMessage
|
35
|
+
from logger_36.task.format.rule import Rule
|
35
36
|
from logger_36.task.measure.chronos import ElapsedTime
|
36
37
|
from logger_36.task.measure.memory import CurrentUsage as CurrentMemoryUsage
|
37
38
|
from logger_36.type.issue import NewIssue, issue_t
|
@@ -42,12 +43,14 @@ class logger_t(lggg.Logger):
|
|
42
43
|
name_: d.InitVar[str] = LOGGER_NAME
|
43
44
|
level_: d.InitVar[int] = lggg.NOTSET
|
44
45
|
activate_wrn_interceptions: d.InitVar[bool] = True
|
45
|
-
|
46
|
-
exit_on_critical: bool = False
|
46
|
+
|
47
47
|
# Must not be False until at least one handler has been added.
|
48
48
|
should_hold_messages: bool = True
|
49
|
+
exit_on_error: bool = False # Implies exit_on_critical.
|
50
|
+
exit_on_critical: bool = False
|
49
51
|
|
50
52
|
on_hold: list[lggg.LogRecord] = d.field(init=False, default_factory=list)
|
53
|
+
events: dict[int, int] = d.field(init=False, default_factory=dict)
|
51
54
|
last_message_date: str = d.field(init=False, default="")
|
52
55
|
any_handler_shows_memory: bool = d.field(init=False, default=False)
|
53
56
|
memory_usages: list[tuple[str, int]] = d.field(init=False, default_factory=list)
|
@@ -66,11 +69,19 @@ class logger_t(lggg.Logger):
|
|
66
69
|
self.setLevel(level_)
|
67
70
|
self.propagate = False # Part of lggg.Logger.
|
68
71
|
|
72
|
+
for level in lggg.getLevelNamesMapping().values():
|
73
|
+
self.events[level] = 0
|
74
|
+
|
69
75
|
if activate_wrn_interceptions:
|
70
76
|
self._ActivateWarningInterceptions()
|
71
77
|
if self.exit_on_error:
|
72
78
|
self.exit_on_critical = True
|
73
79
|
|
80
|
+
def ResetEventCounts(self) -> None:
|
81
|
+
""""""
|
82
|
+
for level in self.events:
|
83
|
+
self.events[level] = 0
|
84
|
+
|
74
85
|
def _ActivateWarningInterceptions(self) -> None:
|
75
86
|
"""
|
76
87
|
The log message will not appear if called from __post_init__ since there are no
|
@@ -214,6 +225,7 @@ class logger_t(lggg.Logger):
|
|
214
225
|
else:
|
215
226
|
lggg.Logger.handle(self, record)
|
216
227
|
|
228
|
+
self.events[record.levelno] += 1
|
217
229
|
if (self.exit_on_critical and (record.levelno is lggg.CRITICAL)) or (
|
218
230
|
self.exit_on_error and (record.levelno is lggg.ERROR)
|
219
231
|
):
|
@@ -226,7 +238,7 @@ class logger_t(lggg.Logger):
|
|
226
238
|
message: str,
|
227
239
|
/,
|
228
240
|
*,
|
229
|
-
level: int = lggg.ERROR,
|
241
|
+
level: int | str = lggg.ERROR,
|
230
242
|
actual: h.Any = NOT_PASSED,
|
231
243
|
expected: h.Any | None = None,
|
232
244
|
expected_is_choices: bool = False,
|
@@ -234,6 +246,8 @@ class logger_t(lggg.Logger):
|
|
234
246
|
with_final_dot: bool = True,
|
235
247
|
) -> None:
|
236
248
|
""""""
|
249
|
+
if isinstance(level, str):
|
250
|
+
level = lggg.getLevelNamesMapping()[level.upper()]
|
237
251
|
message = FormattedMessage(
|
238
252
|
message,
|
239
253
|
actual=actual,
|
@@ -249,10 +263,12 @@ class logger_t(lggg.Logger):
|
|
249
263
|
exception: Exception,
|
250
264
|
/,
|
251
265
|
*,
|
252
|
-
level: int = lggg.ERROR,
|
266
|
+
level: int | str = lggg.ERROR,
|
253
267
|
should_remove_caller: bool = False,
|
254
268
|
) -> None:
|
255
269
|
""""""
|
270
|
+
if isinstance(level, str):
|
271
|
+
level = lggg.getLevelNamesMapping()[level.upper()]
|
256
272
|
lines = tcbk.format_exception(exception)
|
257
273
|
if should_remove_caller:
|
258
274
|
message = "\n".join(lines[:1] + lines[2:])
|
@@ -264,6 +280,20 @@ class logger_t(lggg.Logger):
|
|
264
280
|
message = f"{type(exception).__name__}:\n{formatted}"
|
265
281
|
self.log(level, message)
|
266
282
|
|
283
|
+
def ShowMessage(self, message: str, /) -> None:
|
284
|
+
"""
|
285
|
+
See documentation of
|
286
|
+
logger_36.catalog.handler.generic.generic_handler_t.ShowMessage.
|
287
|
+
"""
|
288
|
+
for handler in self.handlers:
|
289
|
+
ShowMessage = getattr(handler, "ShowMessage", None)
|
290
|
+
if ShowMessage is not None:
|
291
|
+
ShowMessage(message)
|
292
|
+
|
293
|
+
def DisplayRule(self, /, *, text: str | None = None, color: str = "white") -> None:
|
294
|
+
""""""
|
295
|
+
self.ShowMessage(Rule(text, color))
|
296
|
+
|
267
297
|
def AddContextLevel(self, new_level: str, /) -> None:
|
268
298
|
""""""
|
269
299
|
self.context_levels.append(new_level)
|
@@ -360,16 +390,6 @@ class logger_t(lggg.Logger):
|
|
360
390
|
self.log(int(level), issue, stacklevel=2)
|
361
391
|
self.staged_issues.clear()
|
362
392
|
|
363
|
-
def ShowMessage(self, message: str, /) -> None:
|
364
|
-
"""
|
365
|
-
See documentation of
|
366
|
-
logger_36.catalog.handler.generic.generic_handler_t.ShowMessage.
|
367
|
-
"""
|
368
|
-
for handler in self.handlers:
|
369
|
-
ShowMessage = getattr(handler, "ShowMessage", None)
|
370
|
-
if ShowMessage is not None:
|
371
|
-
ShowMessage(message)
|
372
|
-
|
373
393
|
def __enter__(self) -> None:
|
374
394
|
""""""
|
375
395
|
pass
|
logger_36/version.py
CHANGED
@@ -1,14 +1,18 @@
|
|
1
|
-
logger_36/__init__.py,sha256=
|
2
|
-
logger_36/
|
1
|
+
logger_36/__init__.py,sha256=NtDTs3eMKaXTJeujmgj1um3cBVLti0tYuOsdtVk9o9Q,2269
|
2
|
+
logger_36/content.py,sha256=bcMHw_HWJeolnP7KcKREpWbSy9IqWO44beBrisdgeQo,2297
|
3
|
+
logger_36/exception.py,sha256=UsFcsAvd1L4aLj6h7T-DilDm6yO501HDYnGekibiMAU,3260
|
4
|
+
logger_36/gpu.py,sha256=YYFk6aYQrBDJfxQaDm-ar16T6SlOSL6jJWTOgvpF4EU,2244
|
3
5
|
logger_36/handler.py,sha256=9KUu02RpKGKBR358gqS5G1Zut5C6MyBgGzRsQYFBAtY,6721
|
4
|
-
logger_36/
|
5
|
-
logger_36/
|
6
|
-
logger_36/
|
7
|
-
logger_36/
|
8
|
-
logger_36/version.py,sha256=
|
6
|
+
logger_36/memory.py,sha256=FTc3qCeMqnCNvHJ4Yds73noPENQx_U1MYB-R4LLUjVQ,2682
|
7
|
+
logger_36/storage.py,sha256=TNfIXEfHcjixv75wocUyqwX62iDYsor4srRqC3FNzbc,2231
|
8
|
+
logger_36/system.py,sha256=xzm6cMeTaCX9VX9ZRXUXgfqoT9oUtv3W2o_H2W0P-4Q,2243
|
9
|
+
logger_36/time.py,sha256=_CtpQeUZdsUNGNfwzhoWUiUvawRgmonqwZPHouzWf5M,2308
|
10
|
+
logger_36/version.py,sha256=C_q5mLo__HXHHvcfHIjNc1a_cFQMKdfy8MRQmswsFq8,2206
|
11
|
+
logger_36/api/logger.py,sha256=Wg2nzQeuRVZ4v-oy3Q2KdYsHSzF9v7a0Fk6BzLnbkYw,2225
|
12
|
+
logger_36/api/storage.py,sha256=evKVqIsslA5X82LaZ2HQDxp7ltyNOn8Tr-3-Pic3eUo,2231
|
9
13
|
logger_36/catalog/config/console_rich.py,sha256=QDkgSs3I7ZULvkd1q4J1hdvgyB857JJcJWxM9fdL51Y,2883
|
10
14
|
logger_36/catalog/handler/console.py,sha256=SF9S3CUoEPp5dh7RrqotywDJjMgRp0rD9sO3eLVXnkA,4004
|
11
|
-
logger_36/catalog/handler/console_rich.py,sha256=
|
15
|
+
logger_36/catalog/handler/console_rich.py,sha256=uLZzVURQ6OIUuQEGMc142vJkEyxBbE0-HJJGQ_zOJcI,8914
|
12
16
|
logger_36/catalog/handler/file.py,sha256=z5ovaOxemh61pbWDCK2sMMlbd1TKwGjMiQhgoicilm4,4456
|
13
17
|
logger_36/catalog/handler/generic.py,sha256=wG6Z1-lHj_9o6cPurEVpPctFlec3BFeqx2mZU_krJt8,8379
|
14
18
|
logger_36/catalog/logger/chronos.py,sha256=eLqQw8N9vaGO23OCf5RrYDPbUeu7epUvDt9rH-dN7i0,2522
|
@@ -34,15 +38,15 @@ logger_36/instance/loggers.py,sha256=RCWpC1NPAf6vXnFc9NqsSALv-x-FEzcH6k_OlxTxeQk
|
|
34
38
|
logger_36/task/inspection.py,sha256=f9VkVrwMJ_ixV9rFu3XUNpmCbEgoo1tssqd2nMeGYLI,5028
|
35
39
|
logger_36/task/storage.py,sha256=XaSeu-iBCa0N8HNpwCV7cLprj-lbOJocpTIKUgSOvsc,5668
|
36
40
|
logger_36/task/format/memory.py,sha256=ECOdHjdxIqXivOwtcmwpLDMYUrutIeOTCn1L4d3-U8k,4241
|
37
|
-
logger_36/task/format/message.py,sha256=
|
38
|
-
logger_36/task/format/rule.py,sha256=
|
39
|
-
logger_36/task/measure/chronos.py,sha256=
|
41
|
+
logger_36/task/format/message.py,sha256=HuV8we1mqh7Xcd4vbwoC0mJ8f_PjtP4sX3WFM6W7Oew,4420
|
42
|
+
logger_36/task/format/rule.py,sha256=M4a8uW7FEvMI9f4s32A9-DoP0WVlLkyXamGnqbzZ65A,2797
|
43
|
+
logger_36/task/measure/chronos.py,sha256=PX7dESj0znstwAWW2tTQ5gcQuIlexzt1ZKcccyp-Ap0,2870
|
40
44
|
logger_36/task/measure/memory.py,sha256=eVw5WOYLyn8o4O4mMArdX2MzsVuhhNDovjYEkk-MIaU,2504
|
41
45
|
logger_36/type/handler.py,sha256=BXpevZhLq5V_IdUfi_LZA4czzlH2SGLpgvbqUBe5X10,8311
|
42
46
|
logger_36/type/issue.py,sha256=Y7OCLCzVt6Yvkecwj8HXLdZjg33oMxexc9XkYHzUhh4,3202
|
43
|
-
logger_36/type/logger.py,sha256=
|
47
|
+
logger_36/type/logger.py,sha256=EM_wtwPSZW4pTvbHma1q2xXjhUpAa6Af67qBNt8Sq4Q,17386
|
44
48
|
logger_36/type/loggers.py,sha256=znqxWBnfQxvkg3VUfbTUvt3S6Kq0DAzWWepxQDt9suI,2871
|
45
|
-
logger_36-2024.
|
46
|
-
logger_36-2024.
|
47
|
-
logger_36-2024.
|
48
|
-
logger_36-2024.
|
49
|
+
logger_36-2024.25.dist-info/METADATA,sha256=YgnEX7JnJeAoOseRKRuJtd2VRyDOJuUXy-Ovel_ywc0,6276
|
50
|
+
logger_36-2024.25.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
51
|
+
logger_36-2024.25.dist-info/top_level.txt,sha256=sM95BTMWmslEEgR_1pzwZsOeSp8C_QBiu8ImbFr0XLc,10
|
52
|
+
logger_36-2024.25.dist-info/RECORD,,
|
File without changes
|
File without changes
|