commit
46d866965d
3 changed files with 12 additions and 10 deletions
|
@ -1092,9 +1092,9 @@ func (bc *Blockchain) persist() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
bc.log.Info("blockchain persist completed",
|
bc.log.Info("persisted to disk",
|
||||||
zap.Uint32("persistedBlocks", diff),
|
zap.Uint32("blocks", diff),
|
||||||
zap.Int("persistedKeys", persisted),
|
zap.Int("keys", persisted),
|
||||||
zap.Uint32("headerHeight", storedHeaderHeight),
|
zap.Uint32("headerHeight", storedHeaderHeight),
|
||||||
zap.Uint32("blockHeight", bHeight),
|
zap.Uint32("blockHeight", bHeight),
|
||||||
zap.Duration("took", time.Since(start)))
|
zap.Duration("took", time.Since(start)))
|
||||||
|
|
|
@ -82,10 +82,14 @@ func Log(ic *interop.Context) error {
|
||||||
if len(state) > MaxNotificationSize {
|
if len(state) > MaxNotificationSize {
|
||||||
return fmt.Errorf("message length shouldn't exceed %v", MaxNotificationSize)
|
return fmt.Errorf("message length shouldn't exceed %v", MaxNotificationSize)
|
||||||
}
|
}
|
||||||
msg := fmt.Sprintf("%q", state)
|
var txHash string
|
||||||
|
if ic.Tx != nil {
|
||||||
|
txHash = ic.Tx.Hash().StringLE()
|
||||||
|
}
|
||||||
ic.Log.Info("runtime log",
|
ic.Log.Info("runtime log",
|
||||||
zap.Stringer("script", ic.VM.GetCurrentScriptHash()),
|
zap.String("tx", txHash),
|
||||||
zap.String("logs", msg))
|
zap.String("script", ic.VM.GetCurrentScriptHash().StringLE()),
|
||||||
|
zap.String("msg", state))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,10 +125,8 @@ func TestLog(t *testing.T) {
|
||||||
var logMsg map[string]interface{}
|
var logMsg map[string]interface{}
|
||||||
require.NoError(t, json.Unmarshal([]byte(ls[0]), &logMsg))
|
require.NoError(t, json.Unmarshal([]byte(ls[0]), &logMsg))
|
||||||
require.Equal(t, "info", logMsg["level"])
|
require.Equal(t, "info", logMsg["level"])
|
||||||
require.Equal(t, "runtime log", logMsg["msg"])
|
require.Equal(t, "hello", logMsg["msg"])
|
||||||
require.Equal(t, h.StringBE(), logMsg["script"])
|
require.Equal(t, h.StringLE(), logMsg["script"])
|
||||||
require.Equal(t, `"hello"`, logMsg["logs"])
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue