go-vise

Constrained Size Output Virtual Machine
Info | Log | Files | Refs | README | LICENSE

commit 596f1bb8877e146c871b0b22b140964aa1306221
parent 7c491422c62ed4e72d09a9c19fff94e8c41b500c
Author: lash <dev@holbrook.no>
Date:   Thu, 20 Apr 2023 20:35:48 +0100

Improve logging

Diffstat:
MREADME.md | 4+++-
Mengine/engine.go | 2++
Mengine/persist.go | 1+
Mpersist/fs.go | 2+-
Mvm/input.go | 1-
5 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md @@ -260,7 +260,7 @@ Outputs bytecodes and templates for test data scenarios used in `engine` unit te ### Interactive runner -`go run ./dev/interactive [-d <data_directory>] [--root <root_symbol>] [--session-id <session_id>]` +`go run ./dev/interactive [-d <data_directory>] [--root <root_symbol>] [--session-id <session_id>] [--persist]` Creates a new interactive session using `engine.DefaultEngine`, starting execution at symbol `root_symbol` @@ -272,6 +272,8 @@ if `root_symbol` is not set, the symbol `root` will be used. if `session_id` is set, mutable data will be stored and retrieved keyed by the given identifer (if implemented). +If `persist` is set, the execution state will be persisted across sessions. + ### Assembler diff --git a/engine/engine.go b/engine/engine.go @@ -60,6 +60,7 @@ func NewEngine(cfg Config, st *state.State, rs resource.Resource, ca cache.Memor // Finish implements EngineIsh interface func(en *Engine) Finish() error { + Logg.Tracef("that's a wrap", "engine", en) return nil } @@ -69,6 +70,7 @@ func(en *Engine) restore() { return } if en.root != location { + Logg.Infof("restoring state: %s", location) en.root = "." } } diff --git a/engine/persist.go b/engine/persist.go @@ -44,6 +44,7 @@ func(pe PersistedEngine) Exec(input []byte, ctx context.Context) (bool, error) { // Finish implements EngineIsh interface func(pe PersistedEngine) Finish() error { + Logg.Tracef("that's a wrap", "engine", pe) return pe.pr.Save(pe.Engine.session) } diff --git a/persist/fs.go b/persist/fs.go @@ -67,7 +67,7 @@ func(p *FsPersister) Save(key string) error { return err } fp := path.Join(p.dir, key) - Logg.Debugf("saved state and cache", "key", key, "bytecode", p.State.Code, "map") + Logg.Debugf("saved state and cache", "key", key, "bytecode", p.State.Code) return ioutil.WriteFile(fp, b, 0600) } diff --git a/vm/input.go b/vm/input.go @@ -61,7 +61,6 @@ func valid(target []byte) bool { if !ok { err = validControl(target) - Logg.Debugf("ouf", "err", err) if err == nil { ok = true }