logger-36 2024.25__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/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 +1 -0
- logger_36/type/logger.py +2 -2
- logger_36/version.py +1 -1
- {logger_36-2024.25.dist-info → logger_36-2024.26.dist-info}/METADATA +1 -1
- {logger_36-2024.25.dist-info → logger_36-2024.26.dist-info}/RECORD +11 -11
- {logger_36-2024.25.dist-info → logger_36-2024.26.dist-info}/WHEEL +0 -0
- {logger_36-2024.25.dist-info → logger_36-2024.26.dist-info}/top_level.txt +0 -0
@@ -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
CHANGED
@@ -4,6 +4,7 @@ Contributor(s): Eric Debreuve (eric.debreuve@cnrs.fr) since 2023
|
|
4
4
|
SEE COPYRIGHT NOTICE BELOW
|
5
5
|
"""
|
6
6
|
|
7
|
+
from logger_36.constant.message import LINE_INDENT
|
7
8
|
from logger_36.task.format.message import FormattedMessage
|
8
9
|
from logger_36.task.format.rule import Rule, RuleAsText
|
9
10
|
|
logger_36/type/logger.py
CHANGED
@@ -280,7 +280,7 @@ class logger_t(lggg.Logger):
|
|
280
280
|
message = f"{type(exception).__name__}:\n{formatted}"
|
281
281
|
self.log(level, message)
|
282
282
|
|
283
|
-
def ShowMessage(self, message: str,
|
283
|
+
def ShowMessage(self, message: str, /, *, indented: bool = False) -> None:
|
284
284
|
"""
|
285
285
|
See documentation of
|
286
286
|
logger_36.catalog.handler.generic.generic_handler_t.ShowMessage.
|
@@ -288,7 +288,7 @@ class logger_t(lggg.Logger):
|
|
288
288
|
for handler in self.handlers:
|
289
289
|
ShowMessage = getattr(handler, "ShowMessage", None)
|
290
290
|
if ShowMessage is not None:
|
291
|
-
ShowMessage(message)
|
291
|
+
ShowMessage(message, indented=indented)
|
292
292
|
|
293
293
|
def DisplayRule(self, /, *, text: str | None = None, color: str = "white") -> None:
|
294
294
|
""""""
|
logger_36/version.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
logger_36/__init__.py,sha256=NtDTs3eMKaXTJeujmgj1um3cBVLti0tYuOsdtVk9o9Q,2269
|
2
|
-
logger_36/content.py,sha256=
|
2
|
+
logger_36/content.py,sha256=jobWhMw249uLfi8d8RFpKQRyyMXD7YQg-DxPMqvj2xs,2348
|
3
3
|
logger_36/exception.py,sha256=UsFcsAvd1L4aLj6h7T-DilDm6yO501HDYnGekibiMAU,3260
|
4
4
|
logger_36/gpu.py,sha256=YYFk6aYQrBDJfxQaDm-ar16T6SlOSL6jJWTOgvpF4EU,2244
|
5
5
|
logger_36/handler.py,sha256=9KUu02RpKGKBR358gqS5G1Zut5C6MyBgGzRsQYFBAtY,6721
|
@@ -7,13 +7,13 @@ 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=aWIezgzKk1mCAVZR34AWQke-WZ-Cj33kdeWtA-fe7SU,2206
|
11
11
|
logger_36/api/logger.py,sha256=Wg2nzQeuRVZ4v-oy3Q2KdYsHSzF9v7a0Fk6BzLnbkYw,2225
|
12
12
|
logger_36/api/storage.py,sha256=evKVqIsslA5X82LaZ2HQDxp7ltyNOn8Tr-3-Pic3eUo,2231
|
13
13
|
logger_36/catalog/config/console_rich.py,sha256=QDkgSs3I7ZULvkd1q4J1hdvgyB857JJcJWxM9fdL51Y,2883
|
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=
|
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
|
17
17
|
logger_36/catalog/handler/generic.py,sha256=wG6Z1-lHj_9o6cPurEVpPctFlec3BFeqx2mZU_krJt8,8379
|
18
18
|
logger_36/catalog/logger/chronos.py,sha256=eLqQw8N9vaGO23OCf5RrYDPbUeu7epUvDt9rH-dN7i0,2522
|
19
19
|
logger_36/catalog/logger/gpu.py,sha256=vUFSP17e7U4nenMi5IMlDiP3cZvXe6nqEDpoqzTavdg,3490
|
@@ -30,7 +30,7 @@ logger_36/constant/handler.py,sha256=HM8qCSEMGNMCzddjUUNBPGL-3d0qU-EmG5eW4ZQHW6A
|
|
30
30
|
logger_36/constant/issue.py,sha256=01l8itRPWGS5F6gXtsXUJgGR-4lS1Eu3_YeKC-khKLw,2315
|
31
31
|
logger_36/constant/logger.py,sha256=0GhemAQ_YBiRO5WQBuNTczuejyVu2IYCsgqPRIbL8es,2780
|
32
32
|
logger_36/constant/memory.py,sha256=ZL1MwbdtNsrCrOwzEyfTsfOoOsRBTJtbbf3otHGnxXo,2343
|
33
|
-
logger_36/constant/message.py,sha256=
|
33
|
+
logger_36/constant/message.py,sha256=u7VH3mj_oW0W33UBIVVzZN1L7iQf4XW0BBr72w6y7bw,2745
|
34
34
|
logger_36/constant/record.py,sha256=zebZYR4buX1lGfc7IyuvEh8zOpk7hx0aS4pJ12H0flI,2311
|
35
35
|
logger_36/constant/system.py,sha256=G2mzBTxRXoJMxb53TnmBaceMJC_q3WonoCG7y6nC_R8,2430
|
36
36
|
logger_36/instance/logger.py,sha256=ttKjl9MD7FUjqCWjv5w2hmmpDYxgaORcYf9NaaE9W_M,2246
|
@@ -44,9 +44,9 @@ logger_36/task/measure/chronos.py,sha256=PX7dESj0znstwAWW2tTQ5gcQuIlexzt1ZKcccyp
|
|
44
44
|
logger_36/task/measure/memory.py,sha256=eVw5WOYLyn8o4O4mMArdX2MzsVuhhNDovjYEkk-MIaU,2504
|
45
45
|
logger_36/type/handler.py,sha256=BXpevZhLq5V_IdUfi_LZA4czzlH2SGLpgvbqUBe5X10,8311
|
46
46
|
logger_36/type/issue.py,sha256=Y7OCLCzVt6Yvkecwj8HXLdZjg33oMxexc9XkYHzUhh4,3202
|
47
|
-
logger_36/type/logger.py,sha256=
|
47
|
+
logger_36/type/logger.py,sha256=J08I5sw7Lr2bEDJo2aJc5b4LgTvU_5O4RCDoBnqsSEw,17432
|
48
48
|
logger_36/type/loggers.py,sha256=znqxWBnfQxvkg3VUfbTUvt3S6Kq0DAzWWepxQDt9suI,2871
|
49
|
-
logger_36-2024.
|
50
|
-
logger_36-2024.
|
51
|
-
logger_36-2024.
|
52
|
-
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
|