cli: use custom logger to filter out runtime.Log messages
``` anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ ./bin/neo-go vm -p _ ____________ __________ _ ____ ___ / | / / ____/ __ \ / ____/ __ \ | | / / |/ / / |/ / __/ / / / /_____/ / __/ / / /____| | / / /|_/ / / /| / /___/ /_/ /_____/ /_/ / /_/ /_____/ |/ / / / / /_/ |_/_____/\____/ \____/\____/ |___/_/ /_/ NEO-GO-VM > loadgo ./1-print/1-print.go READY: loaded 21 instructions NEO-GO-VM 0 > run 2022-10-07T15:28:20.461+0300 INFO runtime log {"tx": "", "script": "db03ceb3f672ee8cd0d714989b4d103ff7eed2f3", "msg": "Hello, world!"} [] ```
This commit is contained in:
parent
b2cd007d8d
commit
95cbddf19e
3 changed files with 51 additions and 3 deletions
|
@ -19,6 +19,9 @@ const (
|
|||
MaxEventNameLen = 32
|
||||
// MaxNotificationSize is the maximum length of a runtime log message.
|
||||
MaxNotificationSize = 1024
|
||||
// SystemRuntimeLogMessage represents log entry message used for output
|
||||
// of the System.Runtime.Log syscall.
|
||||
SystemRuntimeLogMessage = "runtime log"
|
||||
)
|
||||
|
||||
// GetExecutingScriptHash returns executing script hash.
|
||||
|
@ -112,7 +115,7 @@ func Log(ic *interop.Context) error {
|
|||
if ic.Tx != nil {
|
||||
txHash = ic.Tx.Hash().StringLE()
|
||||
}
|
||||
ic.Log.Info("runtime log",
|
||||
ic.Log.Info(SystemRuntimeLogMessage,
|
||||
zap.String("tx", txHash),
|
||||
zap.String("script", ic.VM.GetCurrentScriptHash().StringLE()),
|
||||
zap.String("msg", state))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue