logger-36 2025.12__py3-none-any.whl → 2025.14__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.
@@ -1,196 +0,0 @@
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 logging as l
8
- import sys as s
9
- from pathlib import Path as path_t
10
-
11
- from logger_36.catalog.config.optional import MISSING_RICH_MESSAGE, RICH_IS_AVAILABLE
12
- from logger_36.catalog.handler.console import console_handler_t
13
- from logger_36.catalog.handler.file import file_handler_t
14
- from logger_36.catalog.handler.generic import LogAsIs_h, generic_handler_t
15
-
16
- if RICH_IS_AVAILABLE:
17
- from logger_36.catalog.handler.console_rich import console_rich_handler_t
18
- else:
19
- from logger_36.catalog.handler.console import (
20
- console_handler_t as console_rich_handler_t,
21
- )
22
- _MISSING_RICH_MESSAGE = MISSING_RICH_MESSAGE
23
-
24
-
25
- def AddGenericHandler(
26
- logger: l.Logger,
27
- LogAsIs: LogAsIs_h,
28
- /,
29
- *,
30
- name: str | None = None,
31
- level: int = l.INFO,
32
- should_store_memory_usage: bool = False,
33
- message_width: int = -1,
34
- formatter: l.Formatter | None = None,
35
- supports_html: bool = False,
36
- alternating_logs: int = 0,
37
- should_record: bool = False,
38
- should_hold_messages: bool = False,
39
- **kwargs,
40
- ) -> None:
41
- """"""
42
- handler = generic_handler_t(
43
- name=name,
44
- level=level,
45
- should_store_memory_usage=should_store_memory_usage,
46
- message_width=message_width,
47
- formatter=formatter,
48
- supports_html=supports_html,
49
- alternating_logs=alternating_logs,
50
- should_record=should_record,
51
- rich_kwargs=kwargs,
52
- LogAsIs=LogAsIs,
53
- )
54
- logger.AddHandler(handler, should_hold_messages=should_hold_messages)
55
-
56
-
57
- def AddConsoleHandler(
58
- logger: l.Logger,
59
- /,
60
- *,
61
- name: str | None = None,
62
- level: int = l.INFO,
63
- should_store_memory_usage: bool = False,
64
- message_width: int = -1,
65
- formatter: l.Formatter | None = None,
66
- should_hold_messages: bool = False,
67
- ) -> None:
68
- """"""
69
- handler = console_handler_t(
70
- name=name,
71
- level=level,
72
- should_store_memory_usage=should_store_memory_usage,
73
- message_width=message_width,
74
- formatter=formatter,
75
- )
76
- logger.AddHandler(handler, should_hold_messages=should_hold_messages)
77
-
78
-
79
- def AddRichConsoleHandler(
80
- logger: l.Logger,
81
- /,
82
- *,
83
- name: str | None = None,
84
- level: int = l.INFO,
85
- should_store_memory_usage: bool = False,
86
- message_width: int = -1,
87
- formatter: l.Formatter | None = None,
88
- alternating_logs: int = 0,
89
- should_hold_messages: bool = False,
90
- should_install_traceback: bool = False,
91
- should_record: bool = False,
92
- **kwargs,
93
- ) -> None:
94
- """"""
95
- global _MISSING_RICH_MESSAGE
96
- if _MISSING_RICH_MESSAGE is not None:
97
- s.__stderr__.write(_MISSING_RICH_MESSAGE + "\n")
98
- _MISSING_RICH_MESSAGE = None
99
-
100
- if console_rich_handler_t is console_handler_t:
101
- additional_s = {}
102
- else:
103
- additional_s = {
104
- "alternating_logs": alternating_logs,
105
- "should_install_traceback": should_install_traceback,
106
- "should_record": should_record,
107
- "rich_kwargs": kwargs,
108
- }
109
- handler = console_rich_handler_t(
110
- name=name,
111
- level=level,
112
- should_store_memory_usage=should_store_memory_usage,
113
- message_width=message_width,
114
- formatter=formatter,
115
- **additional_s,
116
- )
117
- logger.AddHandler(handler, should_hold_messages=should_hold_messages)
118
-
119
-
120
- def AddFileHandler(
121
- logger: l.Logger,
122
- path: str | path_t,
123
- /,
124
- *args,
125
- name: str | None = None,
126
- level: int = l.INFO,
127
- should_store_memory_usage: bool = False,
128
- message_width: int = -1,
129
- formatter: l.Formatter | None = None,
130
- should_hold_messages: bool = False,
131
- **kwargs,
132
- ) -> None:
133
- """"""
134
- if isinstance(path, str):
135
- path = path_t(path)
136
- if path.exists():
137
- raise ValueError(f"File or folder already exists: {path}.")
138
-
139
- handler = file_handler_t(
140
- name=name,
141
- level=level,
142
- should_store_memory_usage=should_store_memory_usage,
143
- message_width=message_width,
144
- formatter=formatter,
145
- path=path,
146
- handler_args=args,
147
- handler_kwargs=kwargs,
148
- )
149
- logger.AddHandler(handler, should_hold_messages=should_hold_messages)
150
-
151
-
152
- """
153
- COPYRIGHT NOTICE
154
-
155
- This software is governed by the CeCILL license under French law and
156
- abiding by the rules of distribution of free software. You can use,
157
- modify and/ or redistribute the software under the terms of the CeCILL
158
- license as circulated by CEA, CNRS and INRIA at the following URL
159
- "http://www.cecill.info".
160
-
161
- As a counterpart to the access to the source code and rights to copy,
162
- modify and redistribute granted by the license, users are provided only
163
- with a limited warranty and the software's author, the holder of the
164
- economic rights, and the successive licensors have only limited
165
- liability.
166
-
167
- In this respect, the user's attention is drawn to the risks associated
168
- with loading, using, modifying and/or developing or reproducing the
169
- software by the user in light of its specific status of free software,
170
- that may mean that it is complicated to manipulate, and that also
171
- therefore means that it is reserved for developers and experienced
172
- professionals having in-depth computer knowledge. Users are therefore
173
- encouraged to load and test the software's suitability as regards their
174
- requirements in conditions enabling the security of their systems and/or
175
- data to be ensured and, more generally, to use and operate it in the
176
- same conditions as regards security.
177
-
178
- The fact that you are presently reading this means that you have had
179
- knowledge of the CeCILL license and that you accept its terms.
180
-
181
- SEE LICENCE NOTICE: file README-LICENCE-utf8.txt at project source root.
182
-
183
- This software is being developed by Eric Debreuve, a CNRS employee and
184
- member of team Morpheme.
185
- Team Morpheme is a joint team between Inria, CNRS, and UniCA.
186
- It is hosted by the Centre Inria d'Université Côte d'Azur, Laboratory
187
- I3S, and Laboratory iBV.
188
-
189
- CNRS: https://www.cnrs.fr/index.php/en
190
- Inria: https://www.inria.fr/en/
191
- UniCA: https://univ-cotedazur.eu/
192
- Centre Inria d'Université Côte d'Azur: https://www.inria.fr/en/centre/sophia/
193
- I3S: https://www.i3s.unice.fr/en/
194
- iBV: http://ibv.unice.fr/
195
- Team Morpheme: https://team.inria.fr/morpheme/
196
- """