diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-31 19:56:05 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-31 19:56:05 +0800 |
commit | b1c247231b11f313ca0eedff75ea563926d23f68 (patch) | |
tree | 48b2136cb65e69cb79ffac80f3cc3fdf9dba1cc8 /cmd/mist | |
parent | fd9da72536b73351bbcdc1e9dbbbb8c0e4bfb21b (diff) | |
download | dexon-b1c247231b11f313ca0eedff75ea563926d23f68.tar.gz dexon-b1c247231b11f313ca0eedff75ea563926d23f68.tar.zst dexon-b1c247231b11f313ca0eedff75ea563926d23f68.zip |
ethlog => logger
Diffstat (limited to 'cmd/mist')
-rw-r--r-- | cmd/mist/bindings.go | 16 | ||||
-rw-r--r-- | cmd/mist/ext_app.go | 2 | ||||
-rw-r--r-- | cmd/mist/flags.go | 3 | ||||
-rw-r--r-- | cmd/mist/gui.go | 34 | ||||
-rw-r--r-- | cmd/mist/html_container.go | 8 | ||||
-rw-r--r-- | cmd/mist/main.go | 4 | ||||
-rw-r--r-- | cmd/mist/qml_container.go | 2 | ||||
-rw-r--r-- | cmd/mist/ui_lib.go | 4 |
8 files changed, 36 insertions, 37 deletions
diff --git a/cmd/mist/bindings.go b/cmd/mist/bindings.go index 03d35a574..8b038587b 100644 --- a/cmd/mist/bindings.go +++ b/cmd/mist/bindings.go @@ -23,9 +23,9 @@ import ( "strconv" "github.com/ethereum/go-ethereum/chain" - "github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/utils" ) @@ -35,7 +35,7 @@ type plugin struct { } // LogPrint writes to the GUI log. -func (gui *Gui) LogPrint(level ethlog.LogLevel, msg string) { +func (gui *Gui) LogPrint(level logger.LogLevel, msg string) { /* str := strings.TrimRight(s, "\n") lines := strings.Split(str, "\n") @@ -74,14 +74,14 @@ func (gui *Gui) ToggleTurboMining() { gui.miner.ToggleTurbo() } -// functions that allow Gui to implement interface ethlog.LogSystem -func (gui *Gui) SetLogLevel(level ethlog.LogLevel) { +// functions that allow Gui to implement interface guilogger.LogSystem +func (gui *Gui) SetLogLevel(level logger.LogLevel) { gui.logLevel = level gui.stdLog.SetLogLevel(level) gui.config.Save("loglevel", level) } -func (gui *Gui) GetLogLevel() ethlog.LogLevel { +func (gui *Gui) GetLogLevel() logger.LogLevel { return gui.logLevel } @@ -119,7 +119,7 @@ func (self *Gui) DumpState(hash, path string) { } if block == nil { - logger.Infof("block err: not found %s\n", hash) + guilogger.Infof("block err: not found %s\n", hash) return } @@ -128,12 +128,12 @@ func (self *Gui) DumpState(hash, path string) { file, err := os.OpenFile(path[7:], os.O_CREATE|os.O_RDWR, os.ModePerm) if err != nil { - logger.Infoln("dump err: ", err) + guilogger.Infoln("dump err: ", err) return } defer file.Close() - logger.Infof("dumped state (%s) to %s\n", hash, path) + guilogger.Infof("dumped state (%s) to %s\n", hash, path) file.Write(stateDump) } diff --git a/cmd/mist/ext_app.go b/cmd/mist/ext_app.go index cb014aec4..8af9778bc 100644 --- a/cmd/mist/ext_app.go +++ b/cmd/mist/ext_app.go @@ -74,7 +74,7 @@ func (app *ExtApplication) run() { err := app.container.Create() if err != nil { - logger.Errorln(err) + guilogger.Errorln(err) return } diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index 3aa2e21c8..7de2a881d 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -28,7 +28,6 @@ import ( "runtime" "bitbucket.org/kardianos/osext" - "github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/vm" ) @@ -117,7 +116,7 @@ func Init() { flag.StringVar(&Datadir, "datadir", defaultDataDir(), "specifies the datadir to use") flag.StringVar(&ConfigFile, "conf", defaultConfigFile, "config file") flag.StringVar(&DebugFile, "debug", "", "debug file (no debugging if not set)") - flag.IntVar(&LogLevel, "loglevel", int(ethlog.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)") + flag.IntVar(&LogLevel, "loglevel", int(repllogger.InfoLevel), "loglevel: 0-5: silent,error,warn,info,debug,debug detail)") flag.StringVar(&AssetPath, "asset_path", defaultAssetPath(), "absolute path to GUI assets directory") diff --git a/cmd/mist/gui.go b/cmd/mist/gui.go index c917ad06e..4ae92a340 100644 --- a/cmd/mist/gui.go +++ b/cmd/mist/gui.go @@ -33,11 +33,11 @@ import ( "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/chain" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethlog" "github.com/ethereum/go-ethereum/ethminer" "github.com/ethereum/go-ethereum/ethpipe" "github.com/ethereum/go-ethereum/ethutil" "github.com/ethereum/go-ethereum/ethwire" + "github.com/ethereum/go-ethereum/logger" "gopkg.in/qml.v1" ) @@ -64,7 +64,7 @@ func LoadExtension(path string) (uintptr, error) { } */ -var logger = ethlog.NewLogger("GUI") +var guilogger = logger.NewLogger("GUI") type Gui struct { // The main application window @@ -81,7 +81,7 @@ type Gui struct { txDb *ethdb.LDBDatabase - logLevel ethlog.LogLevel + logLevel logger.LogLevel open bool pipe *ethpipe.JSPipe @@ -93,7 +93,7 @@ type Gui struct { plugins map[string]plugin miner *ethminer.Miner - stdLog ethlog.LogSystem + stdLog logger.LogSystem } // Create GUI, but doesn't start it @@ -104,7 +104,7 @@ func NewWindow(ethereum *eth.Ethereum, config *ethutil.ConfigManager, clientIden } pipe := ethpipe.NewJSPipe(ethereum) - gui := &Gui{eth: ethereum, txDb: db, pipe: pipe, logLevel: ethlog.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, plugins: make(map[string]plugin)} + gui := &Gui{eth: ethereum, txDb: db, pipe: pipe, logLevel: logger.LogLevel(logLevel), Session: session, open: false, clientIdentity: clientIdentity, config: config, plugins: make(map[string]plugin)} data, _ := ethutil.ReadAllFile(path.Join(ethutil.Config.ExecPath, "plugins.json")) json.Unmarshal([]byte(data), &gui.plugins) @@ -155,36 +155,36 @@ func (gui *Gui) Start(assetPath string) { addlog = true } if err != nil { - logger.Errorln("asset not found: you can set an alternative asset path on the command line using option 'asset_path'", err) + guilogger.Errorln("asset not found: you can set an alternative asset path on the command line using option 'asset_path'", err) panic(err) } - logger.Infoln("Starting GUI") + guilogger.Infoln("Starting GUI") gui.open = true win.Show() - // only add the gui logger after window is shown otherwise slider wont be shown + // only add the gui guilogger after window is shown otherwise slider wont be shown if addlog { - ethlog.AddLogSystem(gui) + logger.AddLogSystem(gui) } win.Wait() - // need to silence gui logger after window closed otherwise logsystem hangs (but do not save loglevel) - gui.logLevel = ethlog.Silence + // need to silence gui guilogger after window closed otherwise logsystem hangs (but do not save loglevel) + gui.logLevel = logger.Silence gui.open = false } func (gui *Gui) Stop() { if gui.open { - gui.logLevel = ethlog.Silence + gui.logLevel = logger.Silence gui.open = false gui.win.Hide() } gui.uiLib.jsEngine.Stop() - logger.Infoln("Stopped") + guilogger.Infoln("Stopped") } func (gui *Gui) showWallet(context *qml.Context) (*qml.Window, error) { @@ -229,17 +229,17 @@ func (gui *Gui) createWindow(comp qml.Object) *qml.Window { func (gui *Gui) ImportAndSetPrivKey(secret string) bool { err := gui.eth.KeyManager().InitFromString(gui.Session, 0, secret) if err != nil { - logger.Errorln("unable to import: ", err) + guilogger.Errorln("unable to import: ", err) return false } - logger.Errorln("successfully imported: ", err) + guilogger.Errorln("successfully imported: ", err) return true } func (gui *Gui) CreateAndSetPrivKey() (string, string, string, string) { err := gui.eth.KeyManager().Init(gui.Session, 0, true) if err != nil { - logger.Errorln("unable to create key: ", err) + guilogger.Errorln("unable to create key: ", err) return "", "", "", "" } return gui.eth.KeyManager().KeyPair().AsStrings() @@ -387,7 +387,7 @@ func (gui *Gui) update() { }() for _, plugin := range gui.plugins { - logger.Infoln("Loading plugin ", plugin.Name) + guilogger.Infoln("Loading plugin ", plugin.Name) gui.win.Root().Call("addPlugin", plugin.Path, "") } diff --git a/cmd/mist/html_container.go b/cmd/mist/html_container.go index 96bae1a9a..755d5ea6e 100644 --- a/cmd/mist/html_container.go +++ b/cmd/mist/html_container.go @@ -98,12 +98,12 @@ func (app *HtmlApplication) NewWatcher(quitChan chan bool) { app.watcher, err = fsnotify.NewWatcher() if err != nil { - logger.Infoln("Could not create new auto-reload watcher:", err) + guilogger.Infoln("Could not create new auto-reload watcher:", err) return } err = app.watcher.Watch(app.RootFolder()) if err != nil { - logger.Infoln("Could not start auto-reload watcher:", err) + guilogger.Infoln("Could not start auto-reload watcher:", err) return } for _, folder := range app.RecursiveFolders() { @@ -119,11 +119,11 @@ func (app *HtmlApplication) NewWatcher(quitChan chan bool) { app.watcher.Close() break out case <-app.watcher.Event: - //logger.Debugln("Got event:", ev) + //guilogger.Debugln("Got event:", ev) app.webView.Call("reload") case err := <-app.watcher.Error: // TODO: Do something here - logger.Infoln("Watcher error:", err) + guilogger.Infoln("Watcher error:", err) } } }() diff --git a/cmd/mist/main.go b/cmd/mist/main.go index e739bbff5..b7282d9b5 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -22,7 +22,7 @@ import ( "runtime" "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/ethlog" + "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/utils" "gopkg.in/qml.v1" ) @@ -108,5 +108,5 @@ func main() { } // this blocks the thread ethereum.WaitForShutdown() - ethlog.Flush() + logger.Flush() } diff --git a/cmd/mist/qml_container.go b/cmd/mist/qml_container.go index 3318786e7..13a50d988 100644 --- a/cmd/mist/qml_container.go +++ b/cmd/mist/qml_container.go @@ -50,7 +50,7 @@ func (app *QmlApplication) Create() error { component, err := app.engine.LoadFile(path) if err != nil { - logger.Warnln(err) + guilogger.Warnln(err) } app.win = component.CreateWindow(nil) diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index b12fab603..6fffa845f 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -62,7 +62,7 @@ func NewUiLib(engine *qml.Engine, eth *eth.Ethereum, assetPath string) *UiLib { } func (self *UiLib) Notef(args []interface{}) { - logger.Infoln(args...) + guilogger.Infoln(args...) } func (self *UiLib) LookupDomain(domain string) string { @@ -158,7 +158,7 @@ func (ui *UiLib) OpenBrowser() { func (ui *UiLib) Muted(content string) { component, err := ui.engine.LoadFile(ui.AssetPath("qml/muted.qml")) if err != nil { - logger.Debugln(err) + guilogger.Debugln(err) return } |