Set log level of std logger as well. (since gui logging is disabled)

pull/123/head^2
obscuren 10 years ago
parent 842f2cc8a0
commit 5ac875b097
  1. 2
      ethereal/gui.go
  2. 3
      ethereal/main.go
  3. 1
      ethereum/main.go
  4. 8
      utils/cmd.go

@ -57,6 +57,7 @@ type Gui struct {
plugins map[string]plugin plugins map[string]plugin
miner *ethminer.Miner miner *ethminer.Miner
stdLog ethlog.LogSystem
} }
// Create GUI, but doesn't start it // Create GUI, but doesn't start it
@ -559,6 +560,7 @@ func (gui *Gui) ToggleTurboMining() {
// functions that allow Gui to implement interface ethlog.LogSystem // functions that allow Gui to implement interface ethlog.LogSystem
func (gui *Gui) SetLogLevel(level ethlog.LogLevel) { func (gui *Gui) SetLogLevel(level ethlog.LogLevel) {
gui.logLevel = level gui.logLevel = level
gui.stdLog.SetLogLevel(level)
gui.config.Save("loglevel", level) gui.config.Save("loglevel", level)
} }

@ -25,7 +25,7 @@ func run() error {
utils.InitDataDir(Datadir) utils.InitDataDir(Datadir)
utils.InitLogging(Datadir, LogFile, LogLevel, DebugFile) stdLog := utils.InitLogging(Datadir, LogFile, LogLevel, DebugFile)
db := utils.NewDatabase() db := utils.NewDatabase()
err := utils.DBSanityCheck(db) err := utils.DBSanityCheck(db)
@ -53,6 +53,7 @@ func run() error {
} }
gui := NewWindow(ethereum, config, clientIdentity, KeyRing, LogLevel) gui := NewWindow(ethereum, config, clientIdentity, KeyRing, LogLevel)
gui.stdLog = stdLog
utils.RegisterInterrupt(func(os.Signal) { utils.RegisterInterrupt(func(os.Signal) {
gui.Stop() gui.Stop()

@ -43,6 +43,7 @@ func main() {
err := utils.DBSanityCheck(db) err := utils.DBSanityCheck(db)
if err != nil { if err != nil {
logger.Errorln(err) logger.Errorln(err)
os.Exit(1) os.Exit(1)
} }

@ -100,18 +100,22 @@ func InitDataDir(Datadir string) {
} }
} }
func InitLogging(Datadir string, LogFile string, LogLevel int, DebugFile string) { func InitLogging(Datadir string, LogFile string, LogLevel int, DebugFile string) ethlog.LogSystem {
var writer io.Writer var writer io.Writer
if LogFile == "" { if LogFile == "" {
writer = os.Stdout writer = os.Stdout
} else { } else {
writer = openLogFile(Datadir, LogFile) writer = openLogFile(Datadir, LogFile)
} }
ethlog.AddLogSystem(ethlog.NewStdLogSystem(writer, log.LstdFlags, ethlog.LogLevel(LogLevel)))
sys := ethlog.NewStdLogSystem(writer, log.LstdFlags, ethlog.LogLevel(LogLevel))
ethlog.AddLogSystem(sys)
if DebugFile != "" { if DebugFile != "" {
writer = openLogFile(Datadir, DebugFile) writer = openLogFile(Datadir, DebugFile)
ethlog.AddLogSystem(ethlog.NewStdLogSystem(writer, log.LstdFlags, ethlog.DebugLevel)) ethlog.AddLogSystem(ethlog.NewStdLogSystem(writer, log.LstdFlags, ethlog.DebugLevel))
} }
return sys
} }
func InitConfig(ConfigFile string, Datadir string, EnvPrefix string) *ethutil.ConfigManager { func InitConfig(ConfigFile string, Datadir string, EnvPrefix string) *ethutil.ConfigManager {

Loading…
Cancel
Save