prysm-pulse/shared/cmd/flags.go
Dan b040ac909e Persistent logs (#2660)
* added file log feature

* moved the logic to one central location (shared/logutil/logutil.go), removed new line chars from file logs

* removed a resdundant temp file refrences that went into beachon-chain/BUILD.bazel by mistake

* Update shared/cmd/flags.go

Co-Authored-By: shayzluf <thezluf@gmail.com>

* Update shared/cmd/flags.go

Co-Authored-By: shayzluf <thezluf@gmail.com>

* manually added loguitl dep to the go image target

* Manaully added the logutil dep to the go image target

* Update shared/logutil/logutil.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update validator/main.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update validator/main.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: terence tsao <terence@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: terence tsao <terence@prysmaticlabs.com>

* syntax and styling changes required by code reviewers

* Update beacon-chain/main.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update beacon-chain/main.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* changed the return type of 'ConfigurePersistentLogging' from bool, error to error based on recommendation from code review

* ran goimports in beacon-chain/main.go after tests have failed

* Update beacon-chain/main.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update beacon-chain/main.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update beacon-chain/main.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update shared/logutil/logutil.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update validator/main.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Update validator/main.go

Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>

* Changes requested by code reviewer

* Added a mandatory comment (linter required)  to the 'Fire' event

* Changed the beacon-chain and validator to support only same format stdout and file logging due to complications in the outputs when using different formats.

* Had to run gazelle --fix due to check failure
2019-05-22 09:22:11 -04:00

120 lines
4.3 KiB
Go

// Package cmd defines the command line flags for the shared utlities.
package cmd
import (
"github.com/urfave/cli"
)
var (
// VerbosityFlag defines the logrus configuration.
VerbosityFlag = cli.StringFlag{
Name: "verbosity",
Usage: "Logging verbosity (debug, info=default, warn, error, fatal, panic)",
Value: "info",
}
// DataDirFlag defines a path on disk.
DataDirFlag = DirectoryFlag{
Name: "datadir",
Usage: "Data directory for the databases and keystore",
Value: DirectoryString{DefaultDataDir()},
}
// EnableTracingFlag defines a flag to enable p2p message tracing.
EnableTracingFlag = cli.BoolFlag{
Name: "enable-tracing",
Usage: "Enable request tracing.",
}
// TracingProcessNameFlag defines a flag to specify a process name.
TracingProcessNameFlag = cli.StringFlag{
Name: "tracing-process-name",
Usage: "The name to apply to tracing tag \"process_name\"",
}
// TracingEndpointFlag flag defines the http endpoint for serving traces to Jaeger.
TracingEndpointFlag = cli.StringFlag{
Name: "tracing-endpoint",
Usage: "Tracing endpoint defines where beacon chain traces are exposed to Jaeger.",
Value: "http://127.0.0.1:14268",
}
// TraceSampleFractionFlag defines a flag to indicate what fraction of p2p
// messages are sampled for tracing.
TraceSampleFractionFlag = cli.Float64Flag{
Name: "trace-sample-fraction",
Usage: "Indicate what fraction of p2p messages are sampled for tracing.",
Value: 0.20,
}
// DisableMonitoringFlag defines a flag to disable the metrics collection.
DisableMonitoringFlag = cli.BoolFlag{
Name: "disable-monitoring",
Usage: "Disable monitoring service.",
}
// MonitoringPortFlag defines the http port used to serve prometheus metrics.
MonitoringPortFlag = cli.Int64Flag{
Name: "monitoring-port",
Usage: "Port used to listening and respond metrics for prometheus.",
Value: 8080,
}
// NoDiscovery specifies whether we are running a local network and have no need for connecting
// to the bootstrap nodes in the cloud
NoDiscovery = cli.BoolFlag{
Name: "no-discovery",
Usage: "Enable only local network p2p and do not connect to cloud bootstrap nodes.",
}
// StaticPeers specifies a set of peers to connect to explicitly.
StaticPeers = cli.StringSliceFlag{
Name: "peer",
Usage: "Connect with this peer. This flag may be used multiple times.",
}
// BootstrapNode tells the beacon node which bootstrap node to connect to
BootstrapNode = cli.StringFlag{
Name: "bootstrap-node",
Usage: "The address of bootstrap node. Beacon node will connect for peer discovery via DHT",
Value: "/ip4/35.224.249.2/tcp/30001/p2p/QmQEe7o6hKJdGdSkJRh7WJzS6xrex5f4w2SPR6oWbJNriw",
}
// RelayNode tells the beacon node which relay node to connect to.
RelayNode = cli.StringFlag{
Name: "relay-node",
Usage: "The address of relay node. The beacon node will connect to the " +
"relay node and advertise their address via the relay node to other peers",
Value: "",
}
// P2PPort defines the port to be used by libp2p.
P2PPort = cli.IntFlag{
Name: "p2p-port",
Usage: "The port used by libp2p.",
Value: 12000,
}
// P2PHost defines the host IP to be used by libp2p.
P2PHost = cli.StringFlag{
Name: "p2p-host-ip",
Usage: "The IP address advertised by libp2p. This may be used to advertise an external IP.",
Value: "",
}
// P2PMaxPeers defines a flag to specify the max number of peers in libp2p.
P2PMaxPeers = cli.Int64Flag{
Name: "p2p-max-peers",
Usage: "The max number of p2p peers to maintain.",
Value: 30,
}
// ClearDB tells the beacon node to remove any previously stored data at the data directory.
ClearDB = cli.BoolFlag{
Name: "clear-db",
Usage: "Clears any previously stored data at the data directory",
}
// LogFormat specifies the log output format.
LogFormat = cli.StringFlag{
Name: "log-format",
Usage: "Specify log formatting. Supports: text, json, fluentd.",
Value: "text",
}
// MaxGoroutines specifies the maximum amount of goroutines tolerated, before a status check fails.
MaxGoroutines = cli.Int64Flag{
Name: "max-goroutines",
Usage: "Specifies the upper limit of goroutines running before a status check fails",
Value: 5000,
}
// LogFileName specifies the log output file name.
LogFileName = cli.StringFlag{
Name: "log-file",
Usage: "Specify log file name, relative or absolute",
}
)