Enable console via `.clearing._ems.open_brokerd_dialog()`
Enable console logs for both `.clearing` and `.accounting` in `open_brokerd_dialog()` and pass `loglevel` to all broker-backend trade-dialog endpoints. This ensures all `open_trade_dialog()` will receive the same level passed to the EMS, including the paper engine. Deats, - add `loglevel` param to `mk_paper_ep()` closure. - pass `loglevel=loglevel` to all trade endpoint `open_context()` calls and `mk_paper_ep()` invocations. - change default `loglevel` in `open_ems()` from `'error'` to `'warning'`. - add `get_console_log()` calls for `'clearing'` and `'piker.accounting'` at top of `open_brokerd_dialog()` to ensure those dependent subsystems are console enabled given they're namely used by the `brokerd` trade-dialog ep tasks. (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
50ffc1095b
commit
c1530c7a37
|
|
@ -215,7 +215,7 @@ async def relay_orders_from_sync_code(
|
|||
async def open_ems(
|
||||
fqme: str,
|
||||
mode: str = 'live',
|
||||
loglevel: str = 'error',
|
||||
loglevel: str = 'warning',
|
||||
|
||||
) -> tuple[
|
||||
OrderClient, # client
|
||||
|
|
|
|||
|
|
@ -352,9 +352,21 @@ async def open_brokerd_dialog(
|
|||
broker backend, configuration, or client code usage.
|
||||
|
||||
'''
|
||||
get_console_log(
|
||||
level=loglevel,
|
||||
name='clearing',
|
||||
)
|
||||
# enable `.accounting` console since normally used by
|
||||
# each `brokerd`.
|
||||
get_console_log(
|
||||
level=loglevel,
|
||||
name='piker.accounting',
|
||||
)
|
||||
broker: str = brokermod.name
|
||||
|
||||
def mk_paper_ep():
|
||||
def mk_paper_ep(
|
||||
loglevel: str,
|
||||
):
|
||||
from . import _paper_engine as paper_mod
|
||||
|
||||
nonlocal brokermod, exec_mode
|
||||
|
|
@ -406,17 +418,21 @@ async def open_brokerd_dialog(
|
|||
|
||||
if (
|
||||
trades_endpoint is not None
|
||||
or exec_mode != 'paper'
|
||||
or
|
||||
exec_mode != 'paper'
|
||||
):
|
||||
# open live brokerd trades endpoint
|
||||
open_trades_endpoint = portal.open_context(
|
||||
trades_endpoint,
|
||||
loglevel=loglevel,
|
||||
)
|
||||
|
||||
@acm
|
||||
async def maybe_open_paper_ep():
|
||||
if exec_mode == 'paper':
|
||||
async with mk_paper_ep() as msg:
|
||||
async with mk_paper_ep(
|
||||
loglevel=loglevel,
|
||||
) as msg:
|
||||
yield msg
|
||||
return
|
||||
|
||||
|
|
@ -427,7 +443,9 @@ async def open_brokerd_dialog(
|
|||
# runtime indication that the backend can't support live
|
||||
# order ctrl yet, so boot the paperboi B0
|
||||
if first == 'paper':
|
||||
async with mk_paper_ep() as msg:
|
||||
async with mk_paper_ep(
|
||||
loglevel=loglevel,
|
||||
) as msg:
|
||||
yield msg
|
||||
return
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue