logger-36 2024.1__py3-none-any.whl → 2024.2__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.
Files changed (41) hide show
  1. logger_36/__init__.py +2 -7
  2. logger_36/catalog/config/console_rich.py +49 -0
  3. logger_36/catalog/handler/console.py +80 -0
  4. logger_36/{type/console.py → catalog/handler/console_rich.py} +77 -52
  5. logger_36/catalog/handler/file.py +90 -0
  6. logger_36/catalog/handler/generic.py +150 -0
  7. logger_36/catalog/logging/chronos.py +39 -0
  8. logger_36/catalog/{gpu.py → logging/gpu.py} +3 -1
  9. logger_36/catalog/logging/memory.py +105 -0
  10. logger_36/catalog/{system.py → logging/system.py} +5 -27
  11. logger_36/config/issue.py +32 -0
  12. logger_36/config/memory.py +33 -0
  13. logger_36/{config.py → config/message.py} +14 -14
  14. logger_36/config/system.py +49 -0
  15. logger_36/constant/generic.py +37 -0
  16. logger_36/constant/handler.py +35 -0
  17. logger_36/constant/issue.py +35 -0
  18. logger_36/{type/file.py → constant/logger.py} +13 -15
  19. logger_36/constant/memory.py +39 -0
  20. logger_36/{constant.py → constant/message.py} +11 -15
  21. logger_36/constant/record.py +35 -0
  22. logger_36/constant/system.py +39 -0
  23. logger_36/instance.py +5 -5
  24. logger_36/main.py +130 -32
  25. logger_36/{catalog → task/format}/memory.py +34 -33
  26. logger_36/task/format/message.py +112 -0
  27. logger_36/task/format/rule.py +47 -0
  28. logger_36/task/inspection.py +18 -18
  29. logger_36/{measure → task/measure}/chronos.py +4 -2
  30. logger_36/task/storage.py +64 -3
  31. logger_36/type/extension.py +73 -61
  32. logger_36/type/issue.py +57 -0
  33. logger_36/type/logger.py +349 -0
  34. logger_36/version.py +1 -1
  35. {logger_36-2024.1.dist-info → logger_36-2024.2.dist-info}/METADATA +1 -2
  36. logger_36-2024.2.dist-info/RECORD +39 -0
  37. {logger_36-2024.1.dist-info → logger_36-2024.2.dist-info}/WHEEL +1 -1
  38. logger_36/type/generic.py +0 -115
  39. logger_36-2024.1.dist-info/RECORD +0 -21
  40. /logger_36/{measure → task/measure}/memory.py +0 -0
  41. {logger_36-2024.1.dist-info → logger_36-2024.2.dist-info}/top_level.txt +0 -0
logger_36/type/generic.py DELETED
@@ -1,115 +0,0 @@
1
- # Copyright CNRS/Inria/UCA
2
- # Contributor(s): Eric Debreuve (since 2023)
3
- #
4
- # eric.debreuve@cnrs.fr
5
- #
6
- # This software is governed by the CeCILL license under French law and
7
- # abiding by the rules of distribution of free software. You can use,
8
- # modify and/ or redistribute the software under the terms of the CeCILL
9
- # license as circulated by CEA, CNRS and INRIA at the following URL
10
- # "http://www.cecill.info".
11
- #
12
- # As a counterpart to the access to the source code and rights to copy,
13
- # modify and redistribute granted by the license, users are provided only
14
- # with a limited warranty and the software's author, the holder of the
15
- # economic rights, and the successive licensors have only limited
16
- # liability.
17
- #
18
- # In this respect, the user's attention is drawn to the risks associated
19
- # with loading, using, modifying and/or developing or reproducing the
20
- # software by the user in light of its specific status of free software,
21
- # that may mean that it is complicated to manipulate, and that also
22
- # therefore means that it is reserved for developers and experienced
23
- # professionals having in-depth computer knowledge. Users are therefore
24
- # encouraged to load and test the software's suitability as regards their
25
- # requirements in conditions enabling the security of their systems and/or
26
- # data to be ensured and, more generally, to use and operate it in the
27
- # same conditions as regards security.
28
- #
29
- # The fact that you are presently reading this means that you have had
30
- # knowledge of the CeCILL license and that you accept its terms.
31
-
32
- import logging as lggg
33
- from typing import Callable, Protocol
34
-
35
- from rich.console import Console as console_t
36
- from rich.markup import escape as PreProcessedForRich
37
- from rich.terminal_theme import DEFAULT_TERMINAL_THEME
38
-
39
- from logger_36.type.console import console_handler_t
40
- from logger_36.type.extension import handler_extension_t
41
-
42
-
43
- class can_show_message_p(Protocol):
44
- def Show(self, message: str, /) -> None: ...
45
-
46
-
47
- class generic_handler_t(lggg.Handler, handler_extension_t):
48
- __slots__ = ("console", "Show")
49
- console: console_t | None
50
- Show: Callable[[str], None]
51
-
52
- def __init__(
53
- self,
54
- interface: can_show_message_p | Callable[[str], None],
55
- /,
56
- *args,
57
- supports_html: bool = False,
58
- **kwargs,
59
- ) -> None:
60
- """"""
61
- lggg.Handler.__init__(self, *args, **kwargs)
62
- handler_extension_t.__init__(self)
63
-
64
- if supports_html:
65
- self.console = console_t(
66
- tab_size=console_handler_t.TAB_SIZE,
67
- highlight=False,
68
- force_terminal=True,
69
- )
70
- else:
71
- self.console = None
72
- if hasattr(interface, "Show"):
73
- self.Show = interface.Show
74
- else:
75
- self.Show = interface
76
- self.setFormatter(self.formatter)
77
-
78
- def emit(self, record: lggg.LogRecord, /) -> None:
79
- """"""
80
- if self.console is None:
81
- message, _ = self.MessageLines(record, should_fully_format=True)
82
- else:
83
- first_line, next_lines = self.MessageLines(
84
- record, PreProcessed=PreProcessedForRich
85
- )
86
- highlighted = console_handler_t.HighlightedVersion(
87
- first_line, next_lines, record.levelno
88
- )
89
- segments = self.console.render(highlighted)
90
-
91
- # Inspired from the code of: rich.console.export_html.
92
- html_segments = []
93
- for text, style, _ in segments:
94
- if text == "\n":
95
- html_segments.append("\n")
96
- else:
97
- if style is not None:
98
- style = style.get_html_style(DEFAULT_TERMINAL_THEME)
99
- if (style is not None) and (style.__len__() > 0):
100
- text = f'<span style="{style}">{text}</span>'
101
- html_segments.append(text)
102
- if html_segments[-1] == "\n":
103
- html_segments = html_segments[:-1]
104
-
105
- # /!\ For some reason, the widget splits the message into lines, place each line
106
- # inside a pre tag, and set margin-bottom of the first and list lines to 12px.
107
- # This can be seen by printing self.contents.toHtml(). To avoid the unwanted
108
- # extra margins, margin-bottom is set to 0 below.
109
- message = (
110
- "<pre style='margin-bottom:0px'>" + "".join(html_segments) + "</pre>"
111
- )
112
-
113
- self.Show(message)
114
-
115
- self.ExitOrNotIfError(record)
@@ -1,21 +0,0 @@
1
- logger_36/__init__.py,sha256=ZK4nZo2cycuE3UKjBoqSzH_JrtKiaSTnKBw3tZbzfxk,1875
2
- logger_36/config.py,sha256=ERko-knzRMgKsSXkYBM4A9ec1Yl8PWGub4qODhaQt7Q,2000
3
- logger_36/constant.py,sha256=aFdNXVTN04iwwTk9KwKAO9ttD_LvMFOfHgWHsLMb84Q,2210
4
- logger_36/instance.py,sha256=hb64crFecbnXvAlek8b9WZPc9ip7x9FznrpRoqwNtes,1614
5
- logger_36/main.py,sha256=KZrI33d1tO98jbT7X9hYS_OptvE6r5NGPuToWU5MI64,3437
6
- logger_36/version.py,sha256=7HGe6CUjyMygCnYHQ4opWWAG0kLhqV36brpnaN3cCOs,1575
7
- logger_36/catalog/gpu.py,sha256=CzS4nIUH3iAFczm8SiBfLRFxXYnp7SYysefATEhuCx8,2380
8
- logger_36/catalog/memory.py,sha256=ZC6jBNjpDStvSkwW5jijqcec4KzU3kc5_NNy0MPjWvU,3713
9
- logger_36/catalog/system.py,sha256=VPjz0R6eMLe_xfshC3xB6tC63UfuS6DfD0KkhQY6QRg,2757
10
- logger_36/measure/chronos.py,sha256=absTi1vArUQYxDKdebgjwijT7xunb5uenIj7pT96Maw,2113
11
- logger_36/measure/memory.py,sha256=1f1X-XHd_58LJYJ0Ok5TGIagnf0k5F39IFqWHN2Ojas,1874
12
- logger_36/task/inspection.py,sha256=pey___Q0Kqg-lFoK3OKWfzf8Rm7wm5QulPN_QGIUmww,4127
13
- logger_36/task/storage.py,sha256=gYQkPMAnoW6uihvtO0FlRo6j93DcKtAt7L5PjL-QY7w,3123
14
- logger_36/type/console.py,sha256=jZfXsn6TQNk2nWXgFIHIi__-5bejqmKkVMLhieIDlLc,4862
15
- logger_36/type/extension.py,sha256=RO4hD6YBasKAdNY8QoHzVaW8L5f4pAoyG-r0JvXbuTQ,4812
16
- logger_36/type/file.py,sha256=OLBcnrnQAkIKkVa-qssXMJVdY8kzOmjzQnO9k4NM-sc,2224
17
- logger_36/type/generic.py,sha256=aAf3CIWiNRy0rG8Dn7SQeDQC8w2KPMKvAuIe8i3wxJk,4536
18
- logger_36-2024.1.dist-info/METADATA,sha256=rMmjT0YmhYKvZ1w_Ls71AGGXKKkOwq60KmS89q7malk,4241
19
- logger_36-2024.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
20
- logger_36-2024.1.dist-info/top_level.txt,sha256=sM95BTMWmslEEgR_1pzwZsOeSp8C_QBiu8ImbFr0XLc,10
21
- logger_36-2024.1.dist-info/RECORD,,
File without changes