From a9835c1816bc49ee54c82b4f2a5b05cbcd89881b Mon Sep 17 00:00:00 2001 From: Kurkó Mihály Date: Wed, 11 Jul 2018 10:59:04 +0300 Subject: cmd, dashboard, log: log collection and exploration (#17097) * cmd, dashboard, internal, log, node: logging feature * cmd, dashboard, internal, log: requested changes * dashboard, vendor: gofmt, govendor, use vendored file watcher * dashboard, log: gofmt -s -w, goimports * dashboard, log: gosimple --- node/config.go | 12 ++++++------ node/node.go | 4 ++-- node/service.go | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'node') diff --git a/node/config.go b/node/config.go index 486eddf92..1b75baaeb 100644 --- a/node/config.go +++ b/node/config.go @@ -179,7 +179,7 @@ func (c *Config) NodeDB() string { if c.DataDir == "" { return "" // ephemeral } - return c.resolvePath(datadirNodeDatabase) + return c.ResolvePath(datadirNodeDatabase) } // DefaultIPCEndpoint returns the IPC path used by default. @@ -262,8 +262,8 @@ var isOldGethResource = map[string]bool{ "trusted-nodes.json": true, } -// resolvePath resolves path in the instance directory. -func (c *Config) resolvePath(path string) string { +// ResolvePath resolves path in the instance directory. +func (c *Config) ResolvePath(path string) string { if filepath.IsAbs(path) { return path } @@ -309,7 +309,7 @@ func (c *Config) NodeKey() *ecdsa.PrivateKey { return key } - keyfile := c.resolvePath(datadirPrivateKey) + keyfile := c.ResolvePath(datadirPrivateKey) if key, err := crypto.LoadECDSA(keyfile); err == nil { return key } @@ -332,12 +332,12 @@ func (c *Config) NodeKey() *ecdsa.PrivateKey { // StaticNodes returns a list of node enode URLs configured as static nodes. func (c *Config) StaticNodes() []*discover.Node { - return c.parsePersistentNodes(c.resolvePath(datadirStaticNodes)) + return c.parsePersistentNodes(c.ResolvePath(datadirStaticNodes)) } // TrustedNodes returns a list of node enode URLs configured as trusted nodes. func (c *Config) TrustedNodes() []*discover.Node { - return c.parsePersistentNodes(c.resolvePath(datadirTrustedNodes)) + return c.parsePersistentNodes(c.ResolvePath(datadirTrustedNodes)) } // parsePersistentNodes parses a list of discovery node URLs loaded from a .json diff --git a/node/node.go b/node/node.go index c4368189f..7cc11b781 100644 --- a/node/node.go +++ b/node/node.go @@ -570,12 +570,12 @@ func (n *Node) OpenDatabase(name string, cache, handles int) (ethdb.Database, er if n.config.DataDir == "" { return ethdb.NewMemDatabase(), nil } - return ethdb.NewLDBDatabase(n.config.resolvePath(name), cache, handles) + return ethdb.NewLDBDatabase(n.config.ResolvePath(name), cache, handles) } // ResolvePath returns the absolute path of a resource in the instance directory. func (n *Node) ResolvePath(x string) string { - return n.config.resolvePath(x) + return n.config.ResolvePath(x) } // apis returns the collection of RPC descriptors this node offers. diff --git a/node/service.go b/node/service.go index afc43e848..6a96d9b1e 100644 --- a/node/service.go +++ b/node/service.go @@ -43,7 +43,7 @@ func (ctx *ServiceContext) OpenDatabase(name string, cache int, handles int) (et if ctx.config.DataDir == "" { return ethdb.NewMemDatabase(), nil } - db, err := ethdb.NewLDBDatabase(ctx.config.resolvePath(name), cache, handles) + db, err := ethdb.NewLDBDatabase(ctx.config.ResolvePath(name), cache, handles) if err != nil { return nil, err } @@ -54,7 +54,7 @@ func (ctx *ServiceContext) OpenDatabase(name string, cache int, handles int) (et // and if the user actually uses persistent storage. It will return an empty string // for emphemeral storage and the user's own input for absolute paths. func (ctx *ServiceContext) ResolvePath(path string) string { - return ctx.config.resolvePath(path) + return ctx.config.ResolvePath(path) } // Service retrieves a currently running service registered of a specific type. -- cgit