From 38c61f6f2567e7943c9a16e2be0a2bfedb3a1fb3 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 10 Jun 2015 12:23:49 +0200 Subject: core, core/vm: added structure logging This also reduces the time required spend in the VM --- core/vm_env.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'core/vm_env.go') diff --git a/core/vm_env.go b/core/vm_env.go index c439d2946..da862d5c8 100644 --- a/core/vm_env.go +++ b/core/vm_env.go @@ -16,6 +16,8 @@ type VMEnv struct { depth int chain *ChainManager typ vm.Type + // structured logging + logs []vm.StructLog } func NewEnv(state *state.StateDB, chain *ChainManager, msg Message, block *types.Block) *VMEnv { @@ -47,6 +49,7 @@ func (self *VMEnv) GetHash(n uint64) common.Hash { return common.Hash{} } + func (self *VMEnv) AddLog(log *state.Log) { self.state.AddLog(log) } @@ -68,3 +71,11 @@ func (self *VMEnv) Create(me vm.ContextRef, data []byte, gas, price, value *big. exe := NewExecution(self, nil, data, gas, price, value) return exe.Create(me) } + +func (self *VMEnv) StructLogs() []vm.StructLog { + return self.logs +} + +func (self *VMEnv) AddStructLog(log vm.StructLog) { + self.logs = append(self.logs, log) +} -- cgit v1.2.3