.brokers._daemon: enable `tractor` log in `brokerd`
Also, - capture `Actor.loglevel` in `tll` var for reuse (when `loglevel` is null) and pass `bool`-ed as new `with_tractor_log`-flag. - add `with_tractor_log=bool(tll)` to `.get_console_log()` - add assertion check for logger name. - comment-out `tractor.trionics.collapse_eg()` context for now, pretty sure we don't need it and it just ends up adding extra logging overhead for no good reason (warnings on various `trio` internal cancelled-maskings, etc). - change type annotation: `str|None` vs `str | None`. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codefix_tractor_logging
parent
bdedb16cdc
commit
6d896eeed2
|
|
@ -72,10 +72,14 @@ async def _setup_persistent_brokerd(
|
||||||
# since all hosted daemon tasks will reference this same
|
# since all hosted daemon tasks will reference this same
|
||||||
# log instance's (actor local) state and thus don't require
|
# log instance's (actor local) state and thus don't require
|
||||||
# any further (level) configuration on their own B)
|
# any further (level) configuration on their own B)
|
||||||
|
actor: tractor.Actor = tractor.current_actor()
|
||||||
|
tll: str = actor.loglevel
|
||||||
log = _util.get_console_log(
|
log = _util.get_console_log(
|
||||||
loglevel or tractor.current_actor().loglevel,
|
level=loglevel or tll,
|
||||||
name=f'{_util.subsys}.{brokername}',
|
name=f'{_util.subsys}.{brokername}',
|
||||||
|
with_tractor_log=bool(tll),
|
||||||
)
|
)
|
||||||
|
assert log.name == _util.subsys
|
||||||
|
|
||||||
# set global for this actor to this new process-wide instance B)
|
# set global for this actor to this new process-wide instance B)
|
||||||
_util.log = log
|
_util.log = log
|
||||||
|
|
@ -97,7 +101,7 @@ async def _setup_persistent_brokerd(
|
||||||
# NOTE: see ep invocation details inside `.data.feed`.
|
# NOTE: see ep invocation details inside `.data.feed`.
|
||||||
try:
|
try:
|
||||||
async with (
|
async with (
|
||||||
tractor.trionics.collapse_eg(),
|
# tractor.trionics.collapse_eg(),
|
||||||
trio.open_nursery() as service_nursery
|
trio.open_nursery() as service_nursery
|
||||||
):
|
):
|
||||||
bus: _FeedsBus = feed.get_feed_bus(
|
bus: _FeedsBus = feed.get_feed_bus(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue