logger-36 2024.9__py3-none-any.whl → 2024.10__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.
@@ -29,7 +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
- from logger_36.constant.handler import HIDE_WHERE_KWARG
32
+ from logger_36.constant.logger import HIDE_WHERE_KWARG
33
33
  from logger_36.instance import LOGGER
34
34
  from logger_36.task.measure.chronos import ElapsedTime
35
35
 
@@ -29,19 +29,30 @@
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
- from logger_36.constant.handler import HIDE_WHERE_KWARG
32
+ import sys as sstm
33
+
34
+ from logger_36.constant.error import GPU_LOGGING_ERROR
35
+ from logger_36.constant.logger import HIDE_WHERE_KWARG
33
36
  from logger_36.instance import LOGGER
34
37
 
35
38
  try:
36
39
  import tensorflow as tsfl
37
40
  import tensorrt as tsrt
41
+
42
+ _GPU_LOGGING_ERROR = None
38
43
  except ModuleNotFoundError:
39
44
  tsfl = tsrt = None
45
+ _GPU_LOGGING_ERROR = GPU_LOGGING_ERROR
40
46
 
41
47
 
42
48
  def LogGPURelatedDetails() -> None:
43
49
  """"""
50
+ global _GPU_LOGGING_ERROR
51
+
44
52
  if None in (tsfl, tsrt):
53
+ if _GPU_LOGGING_ERROR is not None:
54
+ print(_GPU_LOGGING_ERROR, file=sstm.stderr)
55
+ _GPU_LOGGING_ERROR = None
45
56
  return
46
57
 
47
58
  system_details = tsfl.sysconfig.get_build_info()
@@ -0,0 +1,49 @@
1
+ # Copyright CNRS/Inria/UniCA
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
+ GPU_LOGGING_ERROR = (
33
+ "GPU details cannot be logged because the Tensorflow and/or Tensorrt package(s) "
34
+ "(https://www.tensorflow.org/, https://developer.nvidia.com/tensorrt)"
35
+ "is/are not installed or not importable."
36
+ )
37
+
38
+ MEMORY_MEASURE_ERROR = (
39
+ "Memory usage cannot be shown because the Psutil package "
40
+ "(https://psutil.readthedocs.io/en/latest/)"
41
+ "is not installed or not importable."
42
+ )
43
+
44
+ MISSING_RICH_ERROR = (
45
+ "The Rich console handler is not available because the Rich package "
46
+ "(https://rich.readthedocs.io/en/stable/) "
47
+ "is not installed or not importable. "
48
+ "Falling back to the raw console."
49
+ )
@@ -33,7 +33,3 @@ import typing as h
33
33
 
34
34
  storage_units_h = h.Literal["b", "k", "m", "g", "a"]
35
35
  STORAGE_UNITS: tuple[str, ...] = h.get_args(storage_units_h)
36
-
37
- MEMORY_MEASURE_ERROR = (
38
- "Cannot show memory usage: " 'Package "psutil" not installed or importable.'
39
- )
logger_36/main.py CHANGED
@@ -33,28 +33,24 @@ import logging as lggg
33
33
  import sys as sstm
34
34
  from pathlib import Path as path_t
35
35
 
36
+ from logger_36.catalog.handler.console import console_handler_t
37
+ from logger_36.catalog.handler.file import file_handler_t
38
+ from logger_36.catalog.handler.generic import generic_handler_t, interface_h
39
+ from logger_36.constant.error import MISSING_RICH_ERROR
40
+ from logger_36.constant.handler import HANDLER_CODES, handler_codes_h
41
+ from logger_36.instance import LOGGER
42
+ from logger_36.task.format.message import FormattedMessage
43
+
36
44
  try:
37
45
  from logger_36.catalog.handler.console_rich import console_rich_handler_t
38
46
 
39
- _RICH_ERROR = None
47
+ _MISSING_RICH_ERROR = None
40
48
  except ModuleNotFoundError:
41
49
  from logger_36.catalog.handler.console import (
42
50
  console_handler_t as console_rich_handler_t,
43
51
  )
44
52
 
45
- _RICH_ERROR = (
46
- "The Rich console handler is not available, "
47
- "probably because the Rich package "
48
- "(https://rich.readthedocs.io/en/stable/index.html) "
49
- "is not installed, or not loadable. "
50
- "Falling back to the raw console."
51
- )
52
- from logger_36.catalog.handler.console import console_handler_t
53
- from logger_36.catalog.handler.file import file_handler_t
54
- from logger_36.catalog.handler.generic import generic_handler_t, interface_h
55
- from logger_36.constant.handler import HANDLER_CODES, handler_codes_h
56
- from logger_36.instance import LOGGER
57
- from logger_36.task.format.message import FormattedMessage
53
+ _MISSING_RICH_ERROR = MISSING_RICH_ERROR
58
54
 
59
55
 
60
56
  def AddGenericHandler(
@@ -125,10 +121,10 @@ def AddRichConsoleHandler(
125
121
  **kwargs,
126
122
  ) -> None:
127
123
  """"""
128
- global _RICH_ERROR
129
- if _RICH_ERROR is not None:
130
- print(_RICH_ERROR, file=sstm.stderr)
131
- _RICH_ERROR = None
124
+ global _MISSING_RICH_ERROR
125
+ if _MISSING_RICH_ERROR is not None:
126
+ print(_MISSING_RICH_ERROR, file=sstm.stderr)
127
+ _MISSING_RICH_ERROR = None
132
128
 
133
129
  if logger is None:
134
130
  logger = LOGGER
@@ -35,14 +35,16 @@ import sys as sstm
35
35
  import typing as h
36
36
 
37
37
  from logger_36.config.message import TIME_FORMAT, WHERE_FORMAT
38
+ from logger_36.constant.error import MEMORY_MEASURE_ERROR
38
39
  from logger_36.constant.handler import HANDLER_CODES
39
- from logger_36.constant.memory import MEMORY_MEASURE_ERROR
40
40
  from logger_36.constant.message import NEXT_LINE_PROLOGUE
41
41
  from logger_36.constant.record import HIDE_WHERE_ATTR, SHOW_WHERE_ATTR
42
42
  from logger_36.task.format.message import FormattedMessage, MessageFormat
43
43
  from logger_36.task.measure.chronos import TimeStamp
44
44
  from logger_36.task.measure.memory import CanCheckMemory
45
45
 
46
+ _MEMORY_MEASURE_ERROR = MEMORY_MEASURE_ERROR
47
+
46
48
 
47
49
  @dtcl.dataclass(slots=True, repr=False, eq=False)
48
50
  class handler_extension_t:
@@ -59,6 +61,8 @@ class handler_extension_t:
59
61
  self, handler: lggg.Handler | None, level: int, formatter: lggg.Formatter | None
60
62
  ) -> None:
61
63
  """"""
64
+ global _MEMORY_MEASURE_ERROR
65
+
62
66
  if self.name in HANDLER_CODES:
63
67
  raise ValueError(
64
68
  FormattedMessage(
@@ -73,7 +77,9 @@ class handler_extension_t:
73
77
 
74
78
  if self.show_memory_usage and not CanCheckMemory():
75
79
  self.show_memory_usage = False
76
- print(MEMORY_MEASURE_ERROR, file=sstm.stderr)
80
+ if _MEMORY_MEASURE_ERROR is not None:
81
+ print(_MEMORY_MEASURE_ERROR, file=sstm.stderr)
82
+ _MEMORY_MEASURE_ERROR = None
77
83
 
78
84
  handler.setLevel(level)
79
85
 
logger_36/version.py CHANGED
@@ -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.9"
32
+ __version__ = "2024.10"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: logger-36
3
- Version: 2024.9
3
+ Version: 2024.10
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
@@ -1,25 +1,26 @@
1
1
  logger_36/__init__.py,sha256=67ZAWtUx9Qy8Yn-tLQkOIEO6Z9U-8jhfm-tqNjjeFPU,1758
2
2
  logger_36/instance.py,sha256=wAVty29f24SCs4FRL600QySlA_WeLUM78p4t_Ni-LzA,1618
3
- logger_36/main.py,sha256=o1WOZoQurti7Uw1pkJXmlxTu4zk1SyQOVkmotL4I40Q,6692
4
- logger_36/version.py,sha256=w9erPu07Tga_bXnHyGgWBO3ct9W0EdR8tjDwlHuZJf0,1577
3
+ logger_36/main.py,sha256=peXqcSDTrJhlKQkxSmum94BUJ8pIrtWTfvV9hUXp_pU,6558
4
+ logger_36/version.py,sha256=yjlxOIUGKNxpL_YRAf-O7XKKVh2jWnnOqDCS1DTeuMg,1578
5
5
  logger_36/catalog/config/console_rich.py,sha256=sxxq6iPzlACCMUlDGhDIcDFWY3o6OR5rlg4uOwjsd30,2032
6
6
  logger_36/catalog/handler/console.py,sha256=dm2-_1ZXUd6Gl1uyJaapPhUldzkEZ2fOlgeH8gxmpSs,3094
7
7
  logger_36/catalog/handler/console_rich.py,sha256=TMP9fupSY8OdGb3jeMAeSLjOssJBgcdwkTDo4Enud5U,6513
8
8
  logger_36/catalog/handler/file.py,sha256=tBShoy37F3riXDQc802feKzdpHQj5F3vqKaq211I1WI,3509
9
9
  logger_36/catalog/handler/generic.py,sha256=H0ky_4Ua0_xAXrjtAjVFvSteagdSu1WEXrPKcG4qbRY,6050
10
- logger_36/catalog/logging/chronos.py,sha256=1ZDeRllrYjzvbIt9vrGJhCdQ17Ywlbrn-nRnuM5vsSA,1816
11
- logger_36/catalog/logging/gpu.py,sha256=Or_F_8FWmAFmUhATyZ4gbWWP9YRSSaGEfWKGVAnPlMo,2467
10
+ logger_36/catalog/logging/chronos.py,sha256=zVe5ZwB63mqNqlIDm6ZBi4-U5n_n-21h8umhimRUcdU,1815
11
+ logger_36/catalog/logging/gpu.py,sha256=0XqVVK_TV1QPEwGXyK99jThHAjfsf-V__3m9Jh4gewk,2783
12
12
  logger_36/catalog/logging/memory.py,sha256=-5SOXAV43RnXznBPbClVMpMqtMlVtBsI46w6ngz1oP4,4040
13
13
  logger_36/catalog/logging/system.py,sha256=zomL8kRpmQuVP5KkcJkcUTnXK4ah3yn9PJb_cveNZDQ,2449
14
14
  logger_36/config/issue.py,sha256=wAOChQMpGECw-4Jy0TWArOeQ1P134cGyKaVbc6NrwX8,1639
15
15
  logger_36/config/memory.py,sha256=2OvnG7RMM1aZcUWBYGcNoBdLsQguo8cV862vCYSMbQs,1589
16
16
  logger_36/config/message.py,sha256=ZrR0jE144e88Dy_H5CXfmIAZnNsXH5P6i2VjCKaPU5w,2058
17
17
  logger_36/config/system.py,sha256=i39b-QNbg7i3BW_X-bHH9CqGO6mq1k9Ru5faYPi63SA,1849
18
+ logger_36/constant/error.py,sha256=mqlzrSdOJkuMxtRQnhNXosiGEYp8KInODBJIIdCNgbE,2197
18
19
  logger_36/constant/generic.py,sha256=s0WHW-R_Eu2doDMoGERX3MtfCHmIW6uDjrDt_qP5MLA,1616
19
20
  logger_36/constant/handler.py,sha256=Iw4Pnr5ZUMIeRSA0netupu4icDWoMYKLZRW7_JWbwiI,1683
20
21
  logger_36/constant/issue.py,sha256=08BxREcVT0XnIFV3SrRQNd2uEOtnOP9VtscvRYXz1W4,1658
21
22
  logger_36/constant/logger.py,sha256=-dE218OMVyIgHIIEiXgJ0a4p_76CJk6ULihU0MvJO1g,2152
22
- logger_36/constant/memory.py,sha256=pSACyZ4bvB6AFtcN9tf_zU_Hcjjep5jh30HjDBxE79U,1797
23
+ logger_36/constant/memory.py,sha256=-sgLnUTPsI-e8OwaVFO70Jd2Fl5Fh6ISu_TNuUhV0sM,1688
23
24
  logger_36/constant/message.py,sha256=tklw8IIT8f29lmmkk-se3GM9SKzRvmdIEJTX9ZQu-dc,2086
24
25
  logger_36/constant/record.py,sha256=oEwG4gjhN-Al_1cTjDLdvS_qYKUy4zkR5QUkYocT7eU,1683
25
26
  logger_36/constant/system.py,sha256=dlEU4q-hSFAO6aAa6m_yCGfBwNH5AHTyVZbRFTZ0U0U,1802
@@ -30,10 +31,10 @@ logger_36/task/format/message.py,sha256=91CCgH7umLHUV_YRf4AyOsYZTgNVOvQSODqXO1wJ
30
31
  logger_36/task/format/rule.py,sha256=cq4jl_ZCb8m7QoX8mWevXhy1hgwncLpc-9woKoT7m24,1970
31
32
  logger_36/task/measure/chronos.py,sha256=7xZskYEXQCPDypmnlhn4KDCBB1v3eL1OE_sv-l3n8Do,2255
32
33
  logger_36/task/measure/memory.py,sha256=aichGI-iCeE3Z4Y8AmWGdal2931IMdcdv4VgCeDLBoI,1876
33
- logger_36/type/extension.py,sha256=DBnCTaSqxiqXS79sFXgTf5WO-85ScCV9dbNzrVaWChY,5200
34
+ logger_36/type/extension.py,sha256=P93oObv54OLqRCCR-kmgxosvLKTWMwZwoXNvPMqv6-M,5383
34
35
  logger_36/type/issue.py,sha256=OnkBKRTMsHvZ-2aLQWtBzGSWMTVs_4ermg71Ygcs0w8,2153
35
36
  logger_36/type/logger.py,sha256=eU5BhAETXpUTyY-2MoAOxsgmqaN537TgQkSnNABjoUg,12768
36
- logger_36-2024.9.dist-info/METADATA,sha256=78OmsaRDPKDQugG_x9-FGbEV0wRSc54NP53r0qo3tOc,5569
37
- logger_36-2024.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
38
- logger_36-2024.9.dist-info/top_level.txt,sha256=sM95BTMWmslEEgR_1pzwZsOeSp8C_QBiu8ImbFr0XLc,10
39
- logger_36-2024.9.dist-info/RECORD,,
37
+ logger_36-2024.10.dist-info/METADATA,sha256=xyrCpVKqytvaSQeBroLKYj7a4rIlrx_DG_qhCQsk3HI,5570
38
+ logger_36-2024.10.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
39
+ logger_36-2024.10.dist-info/top_level.txt,sha256=sM95BTMWmslEEgR_1pzwZsOeSp8C_QBiu8ImbFr0XLc,10
40
+ logger_36-2024.10.dist-info/RECORD,,