logger-36 2024.24__py3-none-any.whl → 2024.26__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.py +5 -1
- logger_36/catalog/handler/console_rich.py +9 -7
- logger_36/catalog/handler/file.py +5 -1
- logger_36/constant/message.py +2 -1
- logger_36/content.py +55 -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/measure/chronos.py +2 -7
- logger_36/{measure.py → time.py} +1 -2
- logger_36/type/logger.py +8 -4
- logger_36/version.py +1 -1
- {logger_36-2024.24.dist-info → logger_36-2024.26.dist-info}/METADATA +1 -1
- {logger_36-2024.24.dist-info → logger_36-2024.26.dist-info}/RECORD +21 -17
- /logger_36/{logger_gpu.py → gpu.py} +0 -0
- {logger_36-2024.24.dist-info → logger_36-2024.26.dist-info}/WHEEL +0 -0
- {logger_36-2024.24.dist-info → logger_36-2024.26.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
|
+
"""
|
@@ -6,8 +6,10 @@ SEE COPYRIGHT NOTICE BELOW
|
|
6
6
|
|
7
7
|
import dataclasses as d
|
8
8
|
import logging as lggg
|
9
|
+
import textwrap as text
|
9
10
|
import typing as h
|
10
11
|
|
12
|
+
from logger_36.constant.message import LINE_INDENT
|
11
13
|
from logger_36.constant.record import SHOW_W_RULE_ATTR
|
12
14
|
from logger_36.task.format.rule import RuleAsText
|
13
15
|
from logger_36.type.handler import handler_extension_t
|
@@ -57,11 +59,13 @@ class console_handler_t(lggg.Handler):
|
|
57
59
|
message, _ = self.FormattedLines(record, should_join_lines=True)
|
58
60
|
print(message)
|
59
61
|
|
60
|
-
def ShowMessage(self, message: str,
|
62
|
+
def ShowMessage(self, message: str, /, *, indented: bool = False) -> None:
|
61
63
|
"""
|
62
64
|
See documentation of
|
63
65
|
logger_36.catalog.handler.generic.generic_handler_t.ShowMessage.
|
64
66
|
"""
|
67
|
+
if indented:
|
68
|
+
message = text.indent(message, LINE_INDENT)
|
65
69
|
print(message)
|
66
70
|
|
67
71
|
|
@@ -6,6 +6,7 @@ SEE COPYRIGHT NOTICE BELOW
|
|
6
6
|
|
7
7
|
import dataclasses as d
|
8
8
|
import logging as lggg
|
9
|
+
import textwrap as text
|
9
10
|
import typing as h
|
10
11
|
|
11
12
|
from logger_36.catalog.config.console_rich import (
|
@@ -25,12 +26,13 @@ from logger_36.config.message import (
|
|
25
26
|
LEVEL_CLOSING,
|
26
27
|
WHERE_SEPARATOR,
|
27
28
|
)
|
28
|
-
from logger_36.constant.message import TIME_LENGTH
|
29
|
+
from logger_36.constant.message import LINE_INDENT, TIME_LENGTH
|
29
30
|
from logger_36.constant.record import SHOW_W_RULE_ATTR
|
30
31
|
from logger_36.task.format.rule import Rule
|
31
32
|
from logger_36.type.handler import handler_extension_t
|
32
33
|
from rich.console import Console as console_t
|
33
34
|
from rich.console import RenderableType as renderable_t
|
35
|
+
from rich.markup import escape as EscapedVersion
|
34
36
|
from rich.text import Text as text_t
|
35
37
|
from rich.traceback import install as InstallTracebackHandler
|
36
38
|
|
@@ -139,7 +141,7 @@ class console_rich_handler_t(lggg.Handler):
|
|
139
141
|
if hasattr(record, SHOW_W_RULE_ATTR):
|
140
142
|
richer = Rule(record.msg, DATE_TIME_COLOR)
|
141
143
|
else:
|
142
|
-
first, next_s = self.FormattedLines(record)
|
144
|
+
first, next_s = self.FormattedLines(record, PreProcessed=EscapedVersion)
|
143
145
|
should_highlight_back = self.alternating_lines == 1
|
144
146
|
if self.alternating_lines >= 0:
|
145
147
|
self.alternating_lines = (self.alternating_lines + 1) % 2
|
@@ -153,11 +155,13 @@ class console_rich_handler_t(lggg.Handler):
|
|
153
155
|
)
|
154
156
|
self.console.print(richer, crop=False, overflow="ignore")
|
155
157
|
|
156
|
-
def ShowMessage(self, message: str,
|
158
|
+
def ShowMessage(self, message: str, /, *, indented: bool = False) -> None:
|
157
159
|
"""
|
158
160
|
See documentation of
|
159
161
|
logger_36.catalog.handler.generic.generic_handler_t.ShowMessage.
|
160
162
|
"""
|
163
|
+
if indented:
|
164
|
+
message = text.indent(message, LINE_INDENT)
|
161
165
|
self.console.print(message, crop=False, overflow="ignore")
|
162
166
|
|
163
167
|
|
@@ -172,9 +176,7 @@ def HighlightedVersion(
|
|
172
176
|
background_is_light: bool = True,
|
173
177
|
) -> renderable_t:
|
174
178
|
""""""
|
175
|
-
|
176
|
-
# regardless of the handler (would require styling conversion; html->rich here).
|
177
|
-
output = text_t.from_markup(first_line)
|
179
|
+
output = text_t(first_line)
|
178
180
|
|
179
181
|
# Used instead of _CONTEXT_LENGTH which might include \t, thus creating a
|
180
182
|
# mismatch between character length and length when displayed in console.
|
@@ -194,7 +196,7 @@ def HighlightedVersion(
|
|
194
196
|
output.stylize(ELAPSED_TIME_COLOR, start=elapsed_time_separator)
|
195
197
|
|
196
198
|
if next_lines is not None:
|
197
|
-
output.append(
|
199
|
+
output.append(next_lines)
|
198
200
|
|
199
201
|
_ = output.highlight_regex(ACTUAL_PATTERNS, style=ACTUAL_COLOR)
|
200
202
|
_ = output.highlight_regex(EXPECTED_PATTERNS, style=EXPECTED_COLOR)
|
@@ -6,9 +6,11 @@ SEE COPYRIGHT NOTICE BELOW
|
|
6
6
|
|
7
7
|
import dataclasses as d
|
8
8
|
import logging as lggg
|
9
|
+
import textwrap as text
|
9
10
|
import typing as h
|
10
11
|
from pathlib import Path as path_t
|
11
12
|
|
13
|
+
from logger_36.constant.message import LINE_INDENT
|
12
14
|
from logger_36.constant.record import SHOW_W_RULE_ATTR
|
13
15
|
from logger_36.task.format.rule import RuleAsText
|
14
16
|
from logger_36.type.handler import handler_extension_t
|
@@ -67,11 +69,13 @@ class file_handler_t(lggg.FileHandler):
|
|
67
69
|
print(message, file=self.stream)
|
68
70
|
self.stream.flush()
|
69
71
|
|
70
|
-
def ShowMessage(self, message: str,
|
72
|
+
def ShowMessage(self, message: str, /, *, indented: bool = False) -> None:
|
71
73
|
"""
|
72
74
|
See documentation of
|
73
75
|
logger_36.catalog.handler.generic.generic_handler_t.ShowMessage.
|
74
76
|
"""
|
77
|
+
if indented:
|
78
|
+
message = text.indent(message, LINE_INDENT)
|
75
79
|
print(message, file=self.stream)
|
76
80
|
self.stream.flush()
|
77
81
|
|
logger_36/constant/message.py
CHANGED
@@ -17,7 +17,8 @@ from logger_36.config.message import (
|
|
17
17
|
TIME_LENGTH = time.strftime(TIME_FORMAT, time.gmtime(0)).__len__()
|
18
18
|
LOG_LEVEL_LENGTH = 1 + LEVEL_OPENING.__len__() + LEVEL_CLOSING.__len__()
|
19
19
|
CONTEXT_LENGTH = TIME_LENGTH + LOG_LEVEL_LENGTH
|
20
|
-
|
20
|
+
LINE_INDENT = (CONTEXT_LENGTH + MESSAGE_MARKER.__len__() + 1) * " "
|
21
|
+
NEXT_LINE_PROLOGUE = "\n" + LINE_INDENT
|
21
22
|
|
22
23
|
expected_op_h = h.Literal[":", ": ", "=", "!=", ">=", "<="]
|
23
24
|
EXPECTED_OP: tuple[str, ...] = h.get_args(expected_op_h)
|
logger_36/content.py
ADDED
@@ -0,0 +1,55 @@
|
|
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.constant.message import LINE_INDENT
|
8
|
+
from logger_36.task.format.message import FormattedMessage
|
9
|
+
from logger_36.task.format.rule import Rule, RuleAsText
|
10
|
+
|
11
|
+
"""
|
12
|
+
COPYRIGHT NOTICE
|
13
|
+
|
14
|
+
This software is governed by the CeCILL license under French law and
|
15
|
+
abiding by the rules of distribution of free software. You can use,
|
16
|
+
modify and/ or redistribute the software under the terms of the CeCILL
|
17
|
+
license as circulated by CEA, CNRS and INRIA at the following URL
|
18
|
+
"http://www.cecill.info".
|
19
|
+
|
20
|
+
As a counterpart to the access to the source code and rights to copy,
|
21
|
+
modify and redistribute granted by the license, users are provided only
|
22
|
+
with a limited warranty and the software's author, the holder of the
|
23
|
+
economic rights, and the successive licensors have only limited
|
24
|
+
liability.
|
25
|
+
|
26
|
+
In this respect, the user's attention is drawn to the risks associated
|
27
|
+
with loading, using, modifying and/or developing or reproducing the
|
28
|
+
software by the user in light of its specific status of free software,
|
29
|
+
that may mean that it is complicated to manipulate, and that also
|
30
|
+
therefore means that it is reserved for developers and experienced
|
31
|
+
professionals having in-depth computer knowledge. Users are therefore
|
32
|
+
encouraged to load and test the software's suitability as regards their
|
33
|
+
requirements in conditions enabling the security of their systems and/or
|
34
|
+
data to be ensured and, more generally, to use and operate it in the
|
35
|
+
same conditions as regards security.
|
36
|
+
|
37
|
+
The fact that you are presently reading this means that you have had
|
38
|
+
knowledge of the CeCILL license and that you accept its terms.
|
39
|
+
|
40
|
+
SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
|
41
|
+
|
42
|
+
This software is being developed by Eric Debreuve, a CNRS employee and
|
43
|
+
member of team Morpheme.
|
44
|
+
Team Morpheme is a joint team between Inria, CNRS, and UniCA.
|
45
|
+
It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
|
46
|
+
I3S, and Laboratory iBV.
|
47
|
+
|
48
|
+
CNRS: https://www.cnrs.fr/index.php/en
|
49
|
+
Inria: https://www.inria.fr/en/
|
50
|
+
UniCA: https://univ-cotedazur.eu/
|
51
|
+
Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
|
52
|
+
I3S: https://www.i3s.unice.fr/en/
|
53
|
+
iBV: http://ibv.unice.fr/
|
54
|
+
Team Morpheme: https://team.inria.fr/morpheme/
|
55
|
+
"""
|
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
|
"""
|
@@ -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
@@ -238,7 +238,7 @@ class logger_t(lggg.Logger):
|
|
238
238
|
message: str,
|
239
239
|
/,
|
240
240
|
*,
|
241
|
-
level: int = lggg.ERROR,
|
241
|
+
level: int | str = lggg.ERROR,
|
242
242
|
actual: h.Any = NOT_PASSED,
|
243
243
|
expected: h.Any | None = None,
|
244
244
|
expected_is_choices: bool = False,
|
@@ -246,6 +246,8 @@ class logger_t(lggg.Logger):
|
|
246
246
|
with_final_dot: bool = True,
|
247
247
|
) -> None:
|
248
248
|
""""""
|
249
|
+
if isinstance(level, str):
|
250
|
+
level = lggg.getLevelNamesMapping()[level.upper()]
|
249
251
|
message = FormattedMessage(
|
250
252
|
message,
|
251
253
|
actual=actual,
|
@@ -261,10 +263,12 @@ class logger_t(lggg.Logger):
|
|
261
263
|
exception: Exception,
|
262
264
|
/,
|
263
265
|
*,
|
264
|
-
level: int = lggg.ERROR,
|
266
|
+
level: int | str = lggg.ERROR,
|
265
267
|
should_remove_caller: bool = False,
|
266
268
|
) -> None:
|
267
269
|
""""""
|
270
|
+
if isinstance(level, str):
|
271
|
+
level = lggg.getLevelNamesMapping()[level.upper()]
|
268
272
|
lines = tcbk.format_exception(exception)
|
269
273
|
if should_remove_caller:
|
270
274
|
message = "\n".join(lines[:1] + lines[2:])
|
@@ -276,7 +280,7 @@ class logger_t(lggg.Logger):
|
|
276
280
|
message = f"{type(exception).__name__}:\n{formatted}"
|
277
281
|
self.log(level, message)
|
278
282
|
|
279
|
-
def ShowMessage(self, message: str,
|
283
|
+
def ShowMessage(self, message: str, /, *, indented: bool = False) -> None:
|
280
284
|
"""
|
281
285
|
See documentation of
|
282
286
|
logger_36.catalog.handler.generic.generic_handler_t.ShowMessage.
|
@@ -284,7 +288,7 @@ class logger_t(lggg.Logger):
|
|
284
288
|
for handler in self.handlers:
|
285
289
|
ShowMessage = getattr(handler, "ShowMessage", None)
|
286
290
|
if ShowMessage is not None:
|
287
|
-
ShowMessage(message)
|
291
|
+
ShowMessage(message, indented=indented)
|
288
292
|
|
289
293
|
def DisplayRule(self, /, *, text: str | None = None, color: str = "white") -> None:
|
290
294
|
""""""
|
logger_36/version.py
CHANGED
@@ -1,15 +1,19 @@
|
|
1
|
-
logger_36/__init__.py,sha256=
|
2
|
-
logger_36/
|
1
|
+
logger_36/__init__.py,sha256=NtDTs3eMKaXTJeujmgj1um3cBVLti0tYuOsdtVk9o9Q,2269
|
2
|
+
logger_36/content.py,sha256=jobWhMw249uLfi8d8RFpKQRyyMXD7YQg-DxPMqvj2xs,2348
|
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=aWIezgzKk1mCAVZR34AWQke-WZ-Cj33kdeWtA-fe7SU,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
|
-
logger_36/catalog/handler/console.py,sha256=
|
11
|
-
logger_36/catalog/handler/console_rich.py,sha256=
|
12
|
-
logger_36/catalog/handler/file.py,sha256=
|
14
|
+
logger_36/catalog/handler/console.py,sha256=gSNFCoKfTFg7ID8lJjlbZuVi-4C5j-eQX1q_vllXL9s,4183
|
15
|
+
logger_36/catalog/handler/console_rich.py,sha256=gxh1Ud33SkfFnLs9lRD8mP18wDxJ_18q7YxUP0aVZao,8933
|
16
|
+
logger_36/catalog/handler/file.py,sha256=YBl0-1jBn4W0fm_WYg9zMHwFU9DRaDKOBQsLGle_BSs,4635
|
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
|
15
19
|
logger_36/catalog/logger/gpu.py,sha256=vUFSP17e7U4nenMi5IMlDiP3cZvXe6nqEDpoqzTavdg,3490
|
@@ -26,7 +30,7 @@ logger_36/constant/handler.py,sha256=HM8qCSEMGNMCzddjUUNBPGL-3d0qU-EmG5eW4ZQHW6A
|
|
26
30
|
logger_36/constant/issue.py,sha256=01l8itRPWGS5F6gXtsXUJgGR-4lS1Eu3_YeKC-khKLw,2315
|
27
31
|
logger_36/constant/logger.py,sha256=0GhemAQ_YBiRO5WQBuNTczuejyVu2IYCsgqPRIbL8es,2780
|
28
32
|
logger_36/constant/memory.py,sha256=ZL1MwbdtNsrCrOwzEyfTsfOoOsRBTJtbbf3otHGnxXo,2343
|
29
|
-
logger_36/constant/message.py,sha256=
|
33
|
+
logger_36/constant/message.py,sha256=u7VH3mj_oW0W33UBIVVzZN1L7iQf4XW0BBr72w6y7bw,2745
|
30
34
|
logger_36/constant/record.py,sha256=zebZYR4buX1lGfc7IyuvEh8zOpk7hx0aS4pJ12H0flI,2311
|
31
35
|
logger_36/constant/system.py,sha256=G2mzBTxRXoJMxb53TnmBaceMJC_q3WonoCG7y6nC_R8,2430
|
32
36
|
logger_36/instance/logger.py,sha256=ttKjl9MD7FUjqCWjv5w2hmmpDYxgaORcYf9NaaE9W_M,2246
|
@@ -36,13 +40,13 @@ logger_36/task/storage.py,sha256=XaSeu-iBCa0N8HNpwCV7cLprj-lbOJocpTIKUgSOvsc,566
|
|
36
40
|
logger_36/task/format/memory.py,sha256=ECOdHjdxIqXivOwtcmwpLDMYUrutIeOTCn1L4d3-U8k,4241
|
37
41
|
logger_36/task/format/message.py,sha256=HuV8we1mqh7Xcd4vbwoC0mJ8f_PjtP4sX3WFM6W7Oew,4420
|
38
42
|
logger_36/task/format/rule.py,sha256=M4a8uW7FEvMI9f4s32A9-DoP0WVlLkyXamGnqbzZ65A,2797
|
39
|
-
logger_36/task/measure/chronos.py,sha256=
|
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=J08I5sw7Lr2bEDJo2aJc5b4LgTvU_5O4RCDoBnqsSEw,17432
|
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.26.dist-info/METADATA,sha256=kL7MjQ1ERnbMmk2sz3BkSgMwTOMwn1v9WiQqjG3__GU,6276
|
50
|
+
logger_36-2024.26.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
51
|
+
logger_36-2024.26.dist-info/top_level.txt,sha256=sM95BTMWmslEEgR_1pzwZsOeSp8C_QBiu8ImbFr0XLc,10
|
52
|
+
logger_36-2024.26.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|