aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorKurkó Mihály <kurkomisi@users.noreply.github.com>2018-07-11 15:59:04 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-07-11 15:59:04 +0800
commita9835c1816bc49ee54c82b4f2a5b05cbcd89881b (patch)
treee1badefd627aa3a7c4e1937eab22b8fe3eb204d1 /cmd
parent2eedbe799f5eb8766e4808d8a1810cc1c90c4b93 (diff)
downloaddexon-a9835c1816bc49ee54c82b4f2a5b05cbcd89881b.tar
dexon-a9835c1816bc49ee54c82b4f2a5b05cbcd89881b.tar.gz
dexon-a9835c1816bc49ee54c82b4f2a5b05cbcd89881b.tar.bz2
dexon-a9835c1816bc49ee54c82b4f2a5b05cbcd89881b.tar.lz
dexon-a9835c1816bc49ee54c82b4f2a5b05cbcd89881b.tar.xz
dexon-a9835c1816bc49ee54c82b4f2a5b05cbcd89881b.tar.zst
dexon-a9835c1816bc49ee54c82b4f2a5b05cbcd89881b.zip
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
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/main.go7
-rw-r--r--cmd/swarm/main.go2
-rw-r--r--cmd/utils/flags.go4
3 files changed, 9 insertions, 4 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 52308948f..e42aab30a 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -199,7 +199,12 @@ func init() {
app.Before = func(ctx *cli.Context) error {
runtime.GOMAXPROCS(runtime.NumCPU())
- if err := debug.Setup(ctx); err != nil {
+
+ logdir := ""
+ if ctx.GlobalBool(utils.DashboardEnabledFlag.Name) {
+ logdir = (&node.Config{DataDir: utils.MakeDataDir(ctx)}).ResolvePath("logs")
+ }
+ if err := debug.Setup(ctx, logdir); err != nil {
return err
}
// Cap the cache allowance and tune the garbage collector
diff --git a/cmd/swarm/main.go b/cmd/swarm/main.go
index 8e1a69cb2..7a058b0cb 100644
--- a/cmd/swarm/main.go
+++ b/cmd/swarm/main.go
@@ -432,7 +432,7 @@ pv(1) tool to get a progress bar:
app.Flags = append(app.Flags, swarmmetrics.Flags...)
app.Before = func(ctx *cli.Context) error {
runtime.GOMAXPROCS(runtime.NumCPU())
- if err := debug.Setup(ctx); err != nil {
+ if err := debug.Setup(ctx, ""); err != nil {
return err
}
swarmmetrics.Setup(ctx)
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 46ea7b96b..fb1221365 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -193,7 +193,7 @@ var (
}
// Dashboard settings
DashboardEnabledFlag = cli.BoolFlag{
- Name: "dashboard",
+ Name: metrics.DashboardEnabledFlag,
Usage: "Enable the dashboard",
}
DashboardAddrFlag = cli.StringFlag{
@@ -1185,7 +1185,7 @@ func RegisterEthService(stack *node.Node, cfg *eth.Config) {
// RegisterDashboardService adds a dashboard to the stack.
func RegisterDashboardService(stack *node.Node, cfg *dashboard.Config, commit string) {
stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
- return dashboard.New(cfg, commit)
+ return dashboard.New(cfg, commit, ctx.ResolvePath("logs")), nil
})
}