aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-04-24 09:26:29 +0000
committers-ol <s-ol@users.noreply.github.com>2020-04-24 10:38:23 +0000
commitf189c84d1174713c36d3f2c1d172e1ad76776b47 (patch)
tree4fd1b961ea9a9559563b3f088a6154e2240f69b2 /bin
parentlib/string: fix str/.. (diff)
downloadalive-f189c84d1174713c36d3f2c1d172e1ad76776b47.tar.gz
alive-f189c84d1174713c36d3f2c1d172e1ad76776b47.zip
better logging interface
Diffstat (limited to 'bin')
-rwxr-xr-xbin/alv2
-rwxr-xr-xbin/alv-wx28
2 files changed, 16 insertions, 14 deletions
diff --git a/bin/alv b/bin/alv
index 6abe6c8..02aee7e 100755
--- a/bin/alv
+++ b/bin/alv
@@ -13,7 +13,7 @@ for a in *arg
else
table.insert arguments, a
-Logger.init arguments.log
+Logger\init arguments.log
assert arguments[1], "no filename given"
copilot = Copilot arguments[1]
diff --git a/bin/alv-wx b/bin/alv-wx
index 85d1875..7a61bbe 100755
--- a/bin/alv-wx
+++ b/bin/alv-wx
@@ -10,14 +10,18 @@ from wx
STARTSTOP = 100
-class GUIStream
- new: (@ctrl) =>
-
- write: (...) =>
- message = table.concat {...}, ''
- @ctrl\AppendText message
-
- flush: =>
+class GUILogger extends Logger
+ new: (level, @eval_ctrl, @run_ctrl) =>
+ super level
+
+ set_time: (time) =>
+ @ctrl = switch time
+ when 'eval' then @eval_ctrl
+ when 'run' then @run_ctrl
+ else error "invalid time '#{time}'"
+
+ put: (message) =>
+ @ctrl\AppendText message .. '\n'
class GUICopilot extends Copilot
new: (...) =>
@@ -48,11 +52,9 @@ class GUICopilot extends Copilot
splitter = wxSplitterWindow @frame, wx.wxID_ANY
- eval, ctrl = @mkPanel splitter, 'eval-time messages'
- @eval_stream = GUIStream ctrl
+ eval, @eval_ctrl = @mkPanel splitter, 'eval-time messages'
- run, ctrl = @mkPanel splitter, 'run-time messages'
- @run_stream = GUIStream ctrl
+ run, @run_ctrl = @mkPanel splitter, 'run-time messages'
splitter\SetMinimumPaneSize 60
splitter\SplitHorizontally eval, run, 0
@@ -136,5 +138,5 @@ for a in *arg
table.insert arguments, a
copilot = GUICopilot arguments[1]
-Logger.init arguments.log, copilot.eval_stream
+GUILogger\init arguments.log, copilot.eval_ctrl, copilot.run_ctrl
copilot.app\MainLoop!