logger-36 2024.2__tar.gz → 2024.4__tar.gz

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 (48) hide show
  1. {logger-36-2024.2 → logger-36-2024.4}/PKG-INFO +2 -2
  2. {logger-36-2024.2 → logger-36-2024.4}/documentation/wiki/description.asciidoc +1 -1
  3. {logger-36-2024.2 → logger-36-2024.4}/logger_36/config/issue.py +4 -1
  4. {logger-36-2024.2 → logger-36-2024.4}/logger_36/task/storage.py +3 -3
  5. {logger-36-2024.2 → logger-36-2024.4}/logger_36/type/issue.py +2 -2
  6. {logger-36-2024.2 → logger-36-2024.4}/logger_36/type/logger.py +18 -7
  7. {logger-36-2024.2 → logger-36-2024.4}/logger_36/version.py +1 -1
  8. {logger-36-2024.2 → logger-36-2024.4}/logger_36.egg-info/PKG-INFO +2 -2
  9. {logger-36-2024.2 → logger-36-2024.4}/MANIFEST.in +0 -0
  10. {logger-36-2024.2 → logger-36-2024.4}/README-COPYRIGHT-utf8.txt +0 -0
  11. {logger-36-2024.2 → logger-36-2024.4}/README-LICENCE-utf8.txt +0 -0
  12. {logger-36-2024.2 → logger-36-2024.4}/README.rst +0 -0
  13. {logger-36-2024.2 → logger-36-2024.4}/logger_36/__init__.py +0 -0
  14. {logger-36-2024.2 → logger-36-2024.4}/logger_36/catalog/config/console_rich.py +0 -0
  15. {logger-36-2024.2 → logger-36-2024.4}/logger_36/catalog/handler/console.py +0 -0
  16. {logger-36-2024.2 → logger-36-2024.4}/logger_36/catalog/handler/console_rich.py +0 -0
  17. {logger-36-2024.2 → logger-36-2024.4}/logger_36/catalog/handler/file.py +0 -0
  18. {logger-36-2024.2 → logger-36-2024.4}/logger_36/catalog/handler/generic.py +0 -0
  19. {logger-36-2024.2 → logger-36-2024.4}/logger_36/catalog/logging/chronos.py +0 -0
  20. {logger-36-2024.2 → logger-36-2024.4}/logger_36/catalog/logging/gpu.py +0 -0
  21. {logger-36-2024.2 → logger-36-2024.4}/logger_36/catalog/logging/memory.py +0 -0
  22. {logger-36-2024.2 → logger-36-2024.4}/logger_36/catalog/logging/system.py +0 -0
  23. {logger-36-2024.2 → logger-36-2024.4}/logger_36/config/memory.py +0 -0
  24. {logger-36-2024.2 → logger-36-2024.4}/logger_36/config/message.py +0 -0
  25. {logger-36-2024.2 → logger-36-2024.4}/logger_36/config/system.py +0 -0
  26. {logger-36-2024.2 → logger-36-2024.4}/logger_36/constant/generic.py +0 -0
  27. {logger-36-2024.2 → logger-36-2024.4}/logger_36/constant/handler.py +0 -0
  28. {logger-36-2024.2 → logger-36-2024.4}/logger_36/constant/issue.py +0 -0
  29. {logger-36-2024.2 → logger-36-2024.4}/logger_36/constant/logger.py +0 -0
  30. {logger-36-2024.2 → logger-36-2024.4}/logger_36/constant/memory.py +0 -0
  31. {logger-36-2024.2 → logger-36-2024.4}/logger_36/constant/message.py +0 -0
  32. {logger-36-2024.2 → logger-36-2024.4}/logger_36/constant/record.py +0 -0
  33. {logger-36-2024.2 → logger-36-2024.4}/logger_36/constant/system.py +0 -0
  34. {logger-36-2024.2 → logger-36-2024.4}/logger_36/instance.py +0 -0
  35. {logger-36-2024.2 → logger-36-2024.4}/logger_36/main.py +0 -0
  36. {logger-36-2024.2 → logger-36-2024.4}/logger_36/task/format/memory.py +0 -0
  37. {logger-36-2024.2 → logger-36-2024.4}/logger_36/task/format/message.py +0 -0
  38. {logger-36-2024.2 → logger-36-2024.4}/logger_36/task/format/rule.py +0 -0
  39. {logger-36-2024.2 → logger-36-2024.4}/logger_36/task/inspection.py +0 -0
  40. {logger-36-2024.2 → logger-36-2024.4}/logger_36/task/measure/chronos.py +0 -0
  41. {logger-36-2024.2 → logger-36-2024.4}/logger_36/task/measure/memory.py +0 -0
  42. {logger-36-2024.2 → logger-36-2024.4}/logger_36/type/extension.py +0 -0
  43. {logger-36-2024.2 → logger-36-2024.4}/logger_36.egg-info/SOURCES.txt +0 -0
  44. {logger-36-2024.2 → logger-36-2024.4}/logger_36.egg-info/dependency_links.txt +0 -0
  45. {logger-36-2024.2 → logger-36-2024.4}/logger_36.egg-info/top_level.txt +0 -0
  46. {logger-36-2024.2 → logger-36-2024.4}/pyproject.toml +0 -0
  47. {logger-36-2024.2 → logger-36-2024.4}/setup.cfg +0 -0
  48. {logger-36-2024.2 → logger-36-2024.4}/setup.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: logger-36
3
- Version: 2024.2
4
- Summary: Simple logger using rich_
3
+ Version: 2024.4
4
+ Summary: Simple logger with a catalog of handlers
5
5
  Home-page: https://src.koda.cnrs.fr/eric.debreuve/logger-36/
6
6
  Author: Eric Debreuve
7
7
  Author-email: eric.debreuve@cnrs.fr
@@ -33,7 +33,7 @@
33
33
  :EMAIL: eric.debreuve@cnrs.fr
34
34
 
35
35
  :PROJECT_NAME: logger-36
36
- :SHORT_DESCRIPTION: Simple logger using rich_
36
+ :SHORT_DESCRIPTION: Simple logger with a catalog of handlers
37
37
  :KEYWORDS: log, warning, error
38
38
 
39
39
  :REPOSITORY_NAME: logger-36
@@ -29,4 +29,7 @@
29
29
  # The fact that you are presently reading this means that you have had
30
30
  # knowledge of the CeCILL license and that you accept its terms.
31
31
 
32
- BASE_CONTEXT = "BASE"
32
+ ISSUE_BASE_CONTEXT = "BASE"
33
+
34
+ ISSUE_CONTEXT_SEPARATOR = ">"
35
+ ISSUE_CONTEXT_END = ":: "
@@ -43,11 +43,11 @@ except ModuleNotFoundError:
43
43
 
44
44
  from logger_36.instance import LOGGER
45
45
 
46
+ _BODY_END_PATTERN = r"</[bB][oO][dD][yY]>(.|\n)*$"
47
+
46
48
 
47
49
  @dtcl.dataclass(slots=True, repr=False, eq=False)
48
50
  class html_reader_t(html_parser_t):
49
- BODY_END_PATTERN: h.ClassVar[str] = r"</[bB][oO][dD][yY]>(.|\n)*$"
50
-
51
51
  source: str = ""
52
52
  inside_body: bool = dtcl.field(init=False, default=False)
53
53
  body_position_start: tuple[int, int] = dtcl.field(init=False, default=(-1, -1))
@@ -85,7 +85,7 @@ class html_reader_t(html_parser_t):
85
85
  output[self.body_position_start[0] : (self.body_position_end[0] + 1)]
86
86
  )
87
87
  output = output[self.body_position_start[1] :]
88
- output = regx.sub(self.__class__.BODY_END_PATTERN, "", output, count=1)
88
+ output = regx.sub(_BODY_END_PATTERN, "", output, count=1)
89
89
 
90
90
  return output.strip()
91
91
 
@@ -31,7 +31,7 @@
31
31
 
32
32
  import typing as h
33
33
 
34
- from logger_36.config.issue import BASE_CONTEXT
34
+ from logger_36.config.issue import ISSUE_BASE_CONTEXT
35
35
  from logger_36.constant.generic import NOT_PASSED
36
36
  from logger_36.task.format.message import FormattedMessage
37
37
 
@@ -49,7 +49,7 @@ def NewIssue(
49
49
  ) -> issue_t:
50
50
  """"""
51
51
  if context.__len__() == 0:
52
- context = BASE_CONTEXT
52
+ context = ISSUE_BASE_CONTEXT
53
53
  message = FormattedMessage(
54
54
  message, actual=actual, expected=expected, with_final_dot=False
55
55
  )
@@ -34,12 +34,14 @@ from __future__ import annotations
34
34
  import dataclasses as dtcl
35
35
  import logging as lggg
36
36
  import sys as sstm
37
+ import traceback as tbck
37
38
  import types as t
38
39
  import typing as h
39
40
  from datetime import datetime as dttm
40
41
  from pathlib import Path as path_t
41
42
  from traceback import TracebackException as traceback_t
42
43
 
44
+ from logger_36.config.issue import ISSUE_CONTEXT_END, ISSUE_CONTEXT_SEPARATOR
43
45
  from logger_36.config.message import DATE_FORMAT, INTERCEPTED_LOG_SEPARATOR
44
46
  from logger_36.constant.generic import NOT_PASSED
45
47
  from logger_36.constant.issue import ORDER, order_h
@@ -62,9 +64,6 @@ from logger_36.type.issue import NewIssue, issue_t
62
64
 
63
65
  @dtcl.dataclass(slots=True, repr=False, eq=False)
64
66
  class logger_t(lggg.Logger):
65
- ISSUE_CONTEXT_SEPARATOR: h.ClassVar[str] = ">"
66
- ISSUE_CONTEXT_END: h.ClassVar[str] = ":: "
67
-
68
67
  # Must not be False until at least one handler has been added.
69
68
  should_hold_messages: bool = True
70
69
 
@@ -260,10 +259,9 @@ class logger_t(lggg.Logger):
260
259
  expected: h.Any | None = None,
261
260
  ) -> None:
262
261
  """"""
263
- cls = self.__class__
264
- context = cls.ISSUE_CONTEXT_SEPARATOR.join(self.context_levels)
262
+ context = ISSUE_CONTEXT_SEPARATOR.join(self.context_levels)
265
263
  issue = NewIssue(
266
- context, cls.ISSUE_CONTEXT_END, message, actual=actual, expected=expected
264
+ context, ISSUE_CONTEXT_END, message, actual=actual, expected=expected
267
265
  )
268
266
  self.staged_issues.append(issue)
269
267
 
@@ -274,7 +272,7 @@ class logger_t(lggg.Logger):
274
272
 
275
273
  def CommitIssues(
276
274
  self,
277
- level: int,
275
+ level: int | type[Exception],
278
276
  /,
279
277
  *,
280
278
  order: order_h = "when",
@@ -298,6 +296,19 @@ class logger_t(lggg.Logger):
298
296
  issues = sorted(self.staged_issues, key=lambda _elm: _elm.context)
299
297
  issues = "\n".join(issues)
300
298
 
299
+ if issubclass(level, Exception):
300
+ try:
301
+ raise level("\n" + issues)
302
+ except Exception as exception:
303
+ traceback = "Traceback (most recent call last):\n" + "\n".join(
304
+ tbck.format_stack()[:-1]
305
+ )
306
+ print(traceback[:-1], file=sstm.stderr)
307
+ print(
308
+ "\n".join(tbck.format_exception_only(exception)), file=sstm.stderr
309
+ )
310
+ sstm.exit(1)
311
+
301
312
  self.log(level, issues, **HIDE_WHERE_KWARG)
302
313
  self.staged_issues.clear()
303
314
 
@@ -29,4 +29,4 @@
29
29
  # The fact that you are presently reading this means that you have had
30
30
  # knowledge of the CeCILL license and that you accept its terms.
31
31
 
32
- __version__ = "2024.2"
32
+ __version__ = "2024.4"
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: logger-36
3
- Version: 2024.2
4
- Summary: Simple logger using rich_
3
+ Version: 2024.4
4
+ Summary: Simple logger with a catalog of handlers
5
5
  Home-page: https://src.koda.cnrs.fr/eric.debreuve/logger-36/
6
6
  Author: Eric Debreuve
7
7
  Author-email: eric.debreuve@cnrs.fr
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes