dill: send system output to %logs subscribers

A dill %logs task can be used to open and close subscriptions to "system
output". Whenever dill receives a %text, %talk, or %crud task, it
considers this "system output", and passes it along to all %logs
subscribers.
This commit is contained in:
fang 2023-02-21 16:35:53 +01:00
parent b271d5e3c3
commit ecbf4ce99b
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
2 changed files with 46 additions and 12 deletions

View File

@ -1215,26 +1215,26 @@
[%meld ~] :: unify memory
[%pack ~] :: compact memory
[%trim p=@ud] :: trim kernel state
[%logs =told] :: system output
== ::
+$ task :: in request ->$
$~ [%vega ~] ::
$% [%boot lit=? p=*] :: weird %dill boot
[%crop p=@ud] :: trim kernel state
[%crud p=@tas q=(list tank)] :: print error
[%flog p=flog] :: wrapped error
[%heft ~] :: memory report
$>(%init vane-task) :: after gall ready
[%logs p=(unit ~)] :: watch system output
[%meld ~] :: unify memory
[%pack ~] :: compact memory
[%seat =desk] :: install desk
[%shot ses=@tas task=session-task] :: task for session
[%talk p=(list tank)] :: print tanks
[%text p=tape] :: print tape
$>(%trim vane-task) :: trim state
$>(%vega vane-task) :: report upgrade
[%verb ~] :: verbose mode
[%knob tag=term level=?(%hush %soft %loud)] :: error verbosity
session-task :: for default session
told :: system output
== ::
:: ::
+$ session-task :: session request
@ -1246,6 +1246,12 @@
[%shut ~] :: close session
[%view ~] :: watch session blits
== ::
:: ::
+$ told :: system output
$% [%crud p=@tas q=tang] :: error
[%talk p=(list tank)] :: tanks (in order)
[%text p=tape] :: tape
== ::
::
:::: :: (1d2)
::
@ -1290,11 +1296,11 @@
== ::
+$ flog :: sent to %dill
$% [%crop p=@ud] :: trim kernel state
[%crud p=@tas q=(list tank)] ::
$>(%crud told) ::
[%heft ~] ::
[%meld ~] :: unify memory
[%pack ~] :: compact memory
[%text p=tape] ::
$>(%text told) ::
[%verb ~] :: verbose mode
== ::
:: ::

View File

@ -8,10 +8,11 @@
-- ::
=> |% :: console protocol
+$ axle ::
$: %6 ::
$: %7 ::
hey=(unit duct) :: default duct
dug=(map @tas axon) :: conversations
eye=(jug @tas duct) :: outside listeners
eye=(jug @tas duct) :: outside observers
ear=(set duct) :: syslog listeners
lit=? :: boot in lite mode
$= veb :: vane verbosities
$~ (~(put by *(map @tas log-level)) %hole %soft) :: quiet packet crashes
@ -400,6 +401,18 @@
?: ?=(%flee -.task)
:- ~
..^$(eye.all (~(del ju eye.all) ses hen))
:: %logs opens or closes a subscription to system output
::
?: ?=(%logs -.task)
=. ear.all
?~ p.task (~(del in ear.all) hen)
(~(put in ear.all) hen)
[~ ..^$]
:: if we were $told something, give %logs to all interested parties
::
?: ?=(?(%crud %talk %text) -.task)
:_ ..^$
(turn ~(tap in ear.all) (late %give %logs task))
::
=/ nus
(ax hen ses)
@ -408,8 +421,7 @@
:: could be before %boot (or %boot failed)
::
~& [%dill-call-no-session ses hen -.task]
=/ tan ?:(?=(%crud -.task) q.task ~)
[((slog (flop tan)) ~) ..^$]
[~ ..^$]
::
=^ moz all abet:(call:u.nus task)
[moz ..^$]
@ -417,12 +429,28 @@
++ load :: import old state
=< |= old=any-axle
?- -.old
%6 ..^$(all old)
%7 ..^$(all old)
%6 $(old (axle-6-to-7 old))
%5 $(old (axle-5-to-6 old))
%4 $(old (axle-4-to-5 old))
==
|%
+$ any-axle $%(axle axle-5 axle-4)
+$ any-axle $%(axle axle-6 axle-5 axle-4)
::
+$ axle-6
$: %6
hey=(unit duct)
dug=(map @tas axon)
eye=(jug @tas duct)
lit=?
veb=(map @tas log-level)
egg=_|
==
::
++ axle-6-to-7
|= a=axle-6
^- axle
a(- %7, |4 [~ |4.a])
::
+$ axle-5
$: %5
@ -435,7 +463,7 @@
::
++ axle-5-to-6
|= a=axle-5
^- axle
^- axle-6
:: [%6 hey `(map @tas axon)`dug eye lit veb |]
a(- %6, veb [veb.a &])
::