piker/piker/service/_util.py

26 lines
1.0 KiB
Python
Raw Normal View History

# piker: trading gear for hackers
# Copyright (C) Tyler Goodlet (in stewardship for pikers)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code
2026-02-13 19:34:45 +00:00
Sub-sys module commons (if any ?? Bp).
"""
subsys: str = 'piker.service'
Use `name=__name__` for logs throughout `.service` Change all `.service` sub-modules to use `get_logger(name=__name__)` for per-submod instances vs a shared `._util.log`. Deats, - import `get_logger()` and `get_console_log()` from top-level `piker.log` instead of `._util` for all. - drop `log` and `get_console_log()` partial from `._util`. - add `name=subsys` kwarg to `get_console_log()` call in `_actor_runtime.maybe_open_pikerd()`. - add `name='piker.service'` to `get_console_log()` in `_ahab.open_ahabd()`. - change default `loglevel` from `None` to `'cancel'` in `_ahab.open_ahabd()`. - add sanity check: `assert log.name == 'piker.service'` in `_daemon.maybe_spawn_daemon()`. - change `print()` -> `log.info()` in `_registry.find_service()`. - drop stray `from piker.service._util import log` import in `brokers._daemon.spawn_brokerd()`. Styling/cleanups, - drop blank lines from various fn sigs. - do more sin-ws union type annots. - add more multiline style to `or` expressions in `_actor_runtime` and `_registry`. - update `._util` docstring with TODO about `import`-time console log setup. - add TODO comments in `_registry` about UDS registry support. - use `.aid.uid` from actor in `_registry.open_registry()`. - add intermediate var `reg_addrs` in `_registry.open_registry()` (bc i was tracing rtvs value issues in `tractor`). - add `pformat` import to `.elastic` (code path is currently not used but figured might as well appease the linter..) (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code
2026-02-13 19:34:45 +00:00
# ?TODO, if we were going to keep a `get_console_log()` in here to be
# invoked at `import`-time, how do we dynamically hand in the
# `level=` value? seems too early in the runtime to be injected
# right?