-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #303 from tloncorp/mp/lure-logs
Enable Lure flow logging in %reel and %bait
- Loading branch information
Showing
4 changed files
with
128 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/- *logs | ||
=< | ||
|_ [our=ship =wire] | ||
:: | ||
++ fail | ||
|= [desc=term trace=tang] | ||
^- card:agent:gall | ||
=/ event=$>(%fail log-event) | ||
[%fail desc trace] | ||
(pass event) | ||
:: | ||
++ tell | ||
|= [id=(unit @ta) vol=volume =echo] | ||
^- card:agent:gall | ||
=/ event=$>(%tell log-event) | ||
[%tell id vol echo] | ||
(pass event) | ||
:: | ||
++ pass | ||
|= event=log-event | ||
^- card:agent:gall | ||
[%pass wire %agent [our %logs] %poke log-action+!>([%log event])] | ||
-- | ||
|% | ||
:: | ||
++ fail-event | ||
|= [=term =tang] | ||
^- $>(%fail log-event) | ||
[%fail term tang] | ||
:: | ||
++ tell-event | ||
|= [id=(unit @ta) vol=volume =echo] | ||
^- $>(%tell log-event) | ||
[%tell id vol echo] | ||
:: | ||
++ enjs | ||
=, format | ||
|% | ||
++ tang | ||
|= t=^tang | ||
^- $>(%a json) | ||
?~ t a+~ | ||
=/ tame=(list tape) | ||
%- zing | ||
%+ turn t | ||
(cury wash [0 80]) | ||
a+(turn tame tape:enjs) | ||
:: | ||
++ log-event | ||
|= e=^log-event | ||
^- $>(%o json) | ||
=* event-type -.e | ||
?- -.e | ||
%fail | ||
=- ?>(?=(%o -.-) -) | ||
%- pairs:enjs | ||
:~ type/s+event-type | ||
description/s+desc.e | ||
stacktrace/(tang trace.e) | ||
== | ||
:: | ||
%tell | ||
=- ?>(?=(%o -.-) -) | ||
%- pairs:enjs | ||
:: | ||
:: insert tell id if present | ||
=- ?~ id.e - | ||
[id/s+u.id.e -] | ||
:~ type/s+event-type | ||
message/(tang echo.e) | ||
volume/s+vol.e | ||
== | ||
== | ||
-- | ||
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/+ mp=mop-extensions | ||
:: | ||
|% | ||
:: $echo: formatted message | ||
+$ echo (list tank) | ||
:: $volume: echo volume | ||
+$ volume ?(%info %warn %crit) | ||
:: $log-event | ||
:: | ||
:: %fail: agent failure | ||
:: %tell: agent message | ||
:: | ||
+$ log-event | ||
$% [%fail desc=term trace=tang] | ||
[%tell id=(unit @ta) vol=volume =echo] | ||
== | ||
:: | ||
:: $log-item: event with timestamp | ||
+$ log-item [=time event=log-event] | ||
:: | ||
+$ a-log | ||
$% [%log log-event] | ||
== | ||
-- |