diff --git a/erisdb/serve.go b/erisdb/serve.go index 478ae9aa7b3a1b09d79e7b6dab45ae5fbd2df481..ec998c56feba1fef9f0ec1b5b9272bb8228b025b 100644 --- a/erisdb/serve.go +++ b/erisdb/serve.go @@ -19,6 +19,7 @@ import ( "github.com/tendermint/tendermint/node" ep "github.com/eris-ltd/eris-db/erisdb/pipe" + evm "github.com/eris-ltd/eris-db/evm" "github.com/eris-ltd/eris-db/server" edbapp "github.com/eris-ltd/eris-db/tmsp" @@ -105,6 +106,8 @@ func ServeErisDB(workDir string) (*server.ServeProcess, error) { app := edbapp.NewErisDBApp(state, evsw) app.SetHostAddress(sConf.Consensus.TendermintHost) + evm.SetDebug(sConf.Logging.VMLog) + // Start the tmsp listener for state update commands go func() { // TODO config diff --git a/evm/vm.go b/evm/vm.go index af947fbc3456d1df428f1d68fd27d690a8d64c68..656350bf5e7c653da00722e58598ed3f9d21b73d 100644 --- a/evm/vm.go +++ b/evm/vm.go @@ -36,15 +36,20 @@ func (err ErrPermission) Error() string { return fmt.Sprintf("Contract does not have permission to %s", err.typ) } -type Debug bool - const ( - dataStackCapacity = 1024 - callStackCapacity = 100 // TODO ensure usage. - memoryCapacity = 1024 * 1024 // 1 MB - dbg Debug = true + dataStackCapacity = 1024 + callStackCapacity = 100 // TODO ensure usage. + memoryCapacity = 1024 * 1024 // 1 MB ) +type Debug bool + +var dbg Debug + +func SetDebug(d bool) { + dbg = Debug(d) +} + func (d Debug) Printf(s string, a ...interface{}) { if d { fmt.Printf(s, a...) diff --git a/server/config.go b/server/config.go index 7354408ff26e997e04da58191c5fb41ee86f449c..24b948926c9f153defb2f361e9850ad8512a2ce6 100644 --- a/server/config.go +++ b/server/config.go @@ -54,6 +54,7 @@ type ( ConsoleLogLevel string `toml:"console_log_level"` FileLogLevel string `toml:"file_log_level"` LogFile string `toml:"log_file"` + VMLog bool `toml:"vm_log"` } Consensus struct {