runtimepy 5.7.2__py3-none-any.whl → 5.7.3__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.
runtimepy/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  # =====================================
2
2
  # generator=datazen
3
3
  # version=3.1.4
4
- # hash=0a0c607a8f78dc35cf48427539c9bafa
4
+ # hash=37a32f51e0bf04276100ce27658b7f8f
5
5
  # =====================================
6
6
 
7
7
  """
@@ -10,7 +10,7 @@ Useful defaults and other package metadata.
10
10
 
11
11
  DESCRIPTION = "A framework for implementing Python services."
12
12
  PKG_NAME = "runtimepy"
13
- VERSION = "5.7.2"
13
+ VERSION = "5.7.3"
14
14
 
15
15
  # runtimepy-specific content.
16
16
  METRICS_NAME = "metrics"
@@ -10,7 +10,7 @@ from typing import Any, Iterable
10
10
 
11
11
  # third-party
12
12
  import aiofiles
13
- from vcorelib.logging import LoggerMixin, LoggerType
13
+ from vcorelib.logging import ListLogger, LoggerMixin, LoggerType
14
14
  from vcorelib.paths import Pathlike, normalize
15
15
 
16
16
  # internal
@@ -66,6 +66,25 @@ class LoggerMixinLevelControl(LoggerMixin):
66
66
 
67
67
 
68
68
  LogPaths = Iterable[tuple[LogLevellike, Pathlike]]
69
+ EXT_LOG_EXTRA = {"external": True}
70
+
71
+
72
+ def handle_safe_log(
73
+ logger: LoggerType, level: int, data: str, safe_to_log: bool
74
+ ) -> None:
75
+ """handle a log filtering scenario."""
76
+
77
+ if safe_to_log:
78
+ logger.log(level, data, extra=EXT_LOG_EXTRA)
79
+ else:
80
+ record = logging.LogRecord(
81
+ logger.name, level, __file__, -1, data, (), None
82
+ )
83
+ record.external = True
84
+
85
+ for handler in logger.handlers: # type: ignore
86
+ if isinstance(handler, ListLogger):
87
+ handler.emit(record)
69
88
 
70
89
 
71
90
  class LogCaptureMixin:
@@ -76,7 +95,10 @@ class LogCaptureMixin:
76
95
  # Open aiofiles handles.
77
96
  streams: list[tuple[int, Any]]
78
97
 
79
- ext_log_extra = {"external": True}
98
+ # Set false to only forward to ListLogger handlers. Required for when the
99
+ # system log / process-management logs are being forwarded (otherwise also
100
+ # logging would lead to infinite spam).
101
+ safe_to_log = True
80
102
 
81
103
  async def init_log_capture(
82
104
  self, stack: AsyncExitStack, log_paths: LogPaths
@@ -98,7 +120,8 @@ class LogCaptureMixin:
98
120
 
99
121
  def log_line(self, level: int, data: str) -> None:
100
122
  """Log a line for output."""
101
- self.logger.log(level, data, extra=self.ext_log_extra)
123
+
124
+ handle_safe_log(self.logger, level, data, self.safe_to_log)
102
125
 
103
126
  async def dispatch_log_capture(self) -> None:
104
127
  """Get the next line from this log stream."""
@@ -241,7 +241,9 @@ class ChannelEnvironmentTabHtml(ChannelEnvironmentTabControls):
241
241
  logs = div(
242
242
  tag="textarea",
243
243
  parent=div(parent=vert_container, class_str="form-floating"),
244
- class_str=(f"form-control rounded-0 {TEXT} text-logs"),
244
+ class_str=(
245
+ f"form-control rounded-0 {TEXT} text-body-emphasis text-logs"
246
+ ),
245
247
  id=self.get_id("logs"),
246
248
  title=f"Text logs for {self.name}.",
247
249
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: runtimepy
3
- Version: 5.7.2
3
+ Version: 5.7.3
4
4
  Summary: A framework for implementing Python services.
5
5
  Home-page: https://github.com/vkottler/runtimepy
6
6
  Author: Vaughn Kottler
@@ -18,10 +18,10 @@ Requires-Python: >=3.11
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
20
  Requires-Dist: vcorelib >=3.4.2
21
- Requires-Dist: websockets
22
- Requires-Dist: aiofiles
23
21
  Requires-Dist: psutil
24
22
  Requires-Dist: svgen >=0.6.8
23
+ Requires-Dist: aiofiles
24
+ Requires-Dist: websockets
25
25
  Provides-Extra: test
26
26
  Requires-Dist: pylint ; extra == 'test'
27
27
  Requires-Dist: flake8 ; extra == 'test'
@@ -45,11 +45,11 @@ Requires-Dist: uvloop ; (sys_platform != "win32" and sys_platform != "cygwin") a
45
45
  =====================================
46
46
  generator=datazen
47
47
  version=3.1.4
48
- hash=618546df79dd7f387faa6f84f9a58c79
48
+ hash=ef917873929a5dc6a70367fde7f1447f
49
49
  =====================================
50
50
  -->
51
51
 
52
- # runtimepy ([5.7.2](https://pypi.org/project/runtimepy/))
52
+ # runtimepy ([5.7.3](https://pypi.org/project/runtimepy/))
53
53
 
54
54
  [![python](https://img.shields.io/pypi/pyversions/runtimepy.svg)](https://pypi.org/project/runtimepy/)
55
55
  ![Build Status](https://github.com/vkottler/runtimepy/workflows/Python%20Package/badge.svg)
@@ -1,4 +1,4 @@
1
- runtimepy/__init__.py,sha256=52lFAvkdOBUthOa7tJ66FInklDlbnSn3q9BoqWKadlY,390
1
+ runtimepy/__init__.py,sha256=b_tQ43o1lWUAsbGFaceKvkbUI4Q5uOPR4Jc-EpKyAq8,390
2
2
  runtimepy/__main__.py,sha256=OPAed6hggoQdw-6QAR62mqLC-rCkdDhOq0wyeS2vDRI,332
3
3
  runtimepy/app.py,sha256=sTvatbsGZ2Hdel36Si_WUbNMtg9CzsJyExr5xjIcxDE,970
4
4
  runtimepy/dev_requirements.txt,sha256=j0dh11ztJAzfaUL0iFheGjaZj9ppDzmTkclTT8YKO8c,230
@@ -131,7 +131,7 @@ runtimepy/mixins/async_command.py,sha256=xZNTiRo_Kd_aJboLuFOkQyMo2Exn8ENyY483zdw
131
131
  runtimepy/mixins/enum.py,sha256=IRQR7HD8J0uoxahNqb-2LIVokFn1L2-v9I5HNFw9W3s,719
132
132
  runtimepy/mixins/environment.py,sha256=9dCy7nL1bwZY1p-ez8zy9Jf_6zhljSESnK9F9wtRdl8,3955
133
133
  runtimepy/mixins/finalize.py,sha256=pTziopAWXpyRy0I8UZZv8Q4abXvnH3RrQ_dt3Rh6xlA,1600
134
- runtimepy/mixins/logging.py,sha256=BS1TQTNED-e1rsexhuT2kubP_44MwpiiTSqCgzw56mQ,2991
134
+ runtimepy/mixins/logging.py,sha256=Z5zTIImkkwK0BVhm-4hEP6dzq_8pRkC9wYBCkRskmlc,3735
135
135
  runtimepy/mixins/psutil.py,sha256=RlaEuyQ0-TynQxYW85vFuPiQ-29T2mIrsdaDlpSJq1s,1293
136
136
  runtimepy/mixins/regex.py,sha256=kpCj4iL1akzt_KPPiMP-bTbuLBHOpkUrwbCTRe8HSUk,1061
137
137
  runtimepy/mixins/trig.py,sha256=vkDd9Rh8080gvH5OHkSYmjImVgM_ZZ7RzMxsczKx5N4,2480
@@ -194,7 +194,7 @@ runtimepy/net/server/app/env/widgets.py,sha256=_kNvPl7MXnZOiwTjoZiU2hfuSjkLnRUrO
194
194
  runtimepy/net/server/app/env/tab/__init__.py,sha256=stTVKyHljLQWnnhxkWPwa7bLdZtjhiMFbiVFgbiYaFI,647
195
195
  runtimepy/net/server/app/env/tab/base.py,sha256=hcHKG17JGkAZjl2X7jT1B72RHTeMdocTakFyNKkmWJc,1168
196
196
  runtimepy/net/server/app/env/tab/controls.py,sha256=hsj0ErywfmOBtJLNZbMISrE2ELJEfyXvtCtpsDbXlYg,4734
197
- runtimepy/net/server/app/env/tab/html.py,sha256=wjG_hhuJVeN4xWpGTyQF-TLKmMxc31nfe0zU4wU99S8,7130
197
+ runtimepy/net/server/app/env/tab/html.py,sha256=TSUBTkd6MVpZZHHRknh39EX2KxS6Os9OPtDktUZQolQ,7179
198
198
  runtimepy/net/server/app/env/tab/message.py,sha256=OWqBIPRt6UdBHAXk5qvFMbnWuvIRUyp34lzb3GYdthk,4070
199
199
  runtimepy/net/server/struct/__init__.py,sha256=Zy37r6RLFu-XFr9vsanSq80BJdS6Dxr7zmPzQbb7xdw,1799
200
200
  runtimepy/net/server/websocket/__init__.py,sha256=KISuFUUQwNn6BXo8BOMuMOXyoVqE7Jw94ZQiSCQuRQE,5279
@@ -280,9 +280,9 @@ runtimepy/tui/task.py,sha256=nUZo9fuOC-k1Wpqdzkv9v1tQirCI28fZVgcC13Ijvus,1093
280
280
  runtimepy/tui/channels/__init__.py,sha256=evDaiIn-YS9uGhdo8ZGtP9VK1ek6sr_P1nJ9JuSET0o,4536
281
281
  runtimepy/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
282
282
  runtimepy/ui/controls.py,sha256=yvT7h3thbYaitsakcIAJ90EwKzJ4b-jnc6p3UuVf_XE,1241
283
- runtimepy-5.7.2.dist-info/LICENSE,sha256=okYCYhGsx_BlzvFdoNVBVpw_Cfb4SOqHA_VAARml4Hc,1071
284
- runtimepy-5.7.2.dist-info/METADATA,sha256=alklDGCCJxGdAWxIyShsmg-yZJlbN_arrXDTnMG3QaQ,9308
285
- runtimepy-5.7.2.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
286
- runtimepy-5.7.2.dist-info/entry_points.txt,sha256=-btVBkYv7ybcopqZ_pRky-bEzu3vhbaG3W3Z7ERBiFE,51
287
- runtimepy-5.7.2.dist-info/top_level.txt,sha256=0jPmh6yqHyyJJDwEID-LpQly-9kQ3WRMjH7Lix8peLg,10
288
- runtimepy-5.7.2.dist-info/RECORD,,
283
+ runtimepy-5.7.3.dist-info/LICENSE,sha256=okYCYhGsx_BlzvFdoNVBVpw_Cfb4SOqHA_VAARml4Hc,1071
284
+ runtimepy-5.7.3.dist-info/METADATA,sha256=IklsaVorZGxR7phzqiB4Tvdd8_vzF8GWieYF9Uigurg,9308
285
+ runtimepy-5.7.3.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
286
+ runtimepy-5.7.3.dist-info/entry_points.txt,sha256=-btVBkYv7ybcopqZ_pRky-bEzu3vhbaG3W3Z7ERBiFE,51
287
+ runtimepy-5.7.3.dist-info/top_level.txt,sha256=0jPmh6yqHyyJJDwEID-LpQly-9kQ3WRMjH7Lix8peLg,10
288
+ runtimepy-5.7.3.dist-info/RECORD,,