fix ethtest logging

pull/552/head
zelig 10 years ago
parent 9880f99ccb
commit a983a215dc
  1. 9
      cmd/ethtest/main.go
  2. 12
      logger/logsystem.go
  3. 2
      tests/helper/init.go

@ -33,12 +33,12 @@ import (
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/tests/helper"
"github.com/ethereum/go-ethereum/core/vm"
)
type Log struct {
@ -80,8 +80,7 @@ func StateObjectFromAccount(db common.Database, addr string, account Account) *s
}
type VmTest struct {
Callcreates interface{}
//Env map[string]string
Callcreates interface{}
Env Env
Exec map[string]string
Transaction map[string]string
@ -219,7 +218,7 @@ func RunVmTest(r io.Reader) (failed int) {
}
func main() {
//helper.Logger.SetLogLevel(5)
helper.Logger.SetLogLevel(5)
vm.Debug = true
if len(os.Args) > 1 {

@ -14,17 +14,17 @@ type LogSystem interface {
// NewStdLogSystem creates a LogSystem that prints to the given writer.
// The flag values are defined package log.
func NewStdLogSystem(writer io.Writer, flags int, level LogLevel) LogSystem {
func NewStdLogSystem(writer io.Writer, flags int, level LogLevel) *StdLogSystem {
logger := log.New(writer, "", flags)
return &stdLogSystem{logger, uint32(level)}
return &StdLogSystem{logger, uint32(level)}
}
type stdLogSystem struct {
type StdLogSystem struct {
logger *log.Logger
level uint32
}
func (t *stdLogSystem) LogPrint(msg LogMsg) {
func (t *StdLogSystem) LogPrint(msg LogMsg) {
stdmsg, ok := msg.(stdMsg)
if ok {
if t.GetLogLevel() >= stdmsg.Level() {
@ -33,11 +33,11 @@ func (t *stdLogSystem) LogPrint(msg LogMsg) {
}
}
func (t *stdLogSystem) SetLogLevel(i LogLevel) {
func (t *StdLogSystem) SetLogLevel(i LogLevel) {
atomic.StoreUint32(&t.level, uint32(i))
}
func (t *stdLogSystem) GetLogLevel() LogLevel {
func (t *StdLogSystem) GetLogLevel() LogLevel {
return LogLevel(atomic.LoadUint32(&t.level))
}

@ -7,7 +7,7 @@ import (
logpkg "github.com/ethereum/go-ethereum/logger"
)
var Logger logpkg.LogSystem
var Logger *logpkg.StdLogSystem
var Log = logpkg.NewLogger("TEST")
func init() {

Loading…
Cancel
Save