svoid vmBus_snoopToPrint(IPred shouldPrintMsg) { assertNotNull(shouldPrintMsg); vmBus_snoopToPrint((msg, arg) -> shouldPrintMsg.get(msg)); } svoid vmBus_snoopToPrint(IF2 shouldPrintMsgWithArgs) { assertNotNull(shouldPrintMsgWithArgs); ownResource(vmBus_onAnyMessage(voidfunc(S msg, O _arg) pcall { O arg = _arg; if (!shouldPrintMsgWithArgs.get(msg, arg)) ret; if (arg instanceof O[]) arg = joinWithComma(allToString((O[]) arg)); S s = msg + (arg == null ? "" : " | " + arg); print(localTimeWithSeconds() + " " + shorten(s, 200)); })); }