From 21cf2648236e4bb23c4590a5cc6715cdb40d54fd Mon Sep 17 00:00:00 2001 From: Chris Hager Date: Wed, 28 Sep 2022 09:16:55 +0200 Subject: [PATCH] add a -log-service cli flag (#355) --- cli/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cli/main.go b/cli/main.go index 01424f6b..8c03ec6e 100644 --- a/cli/main.go +++ b/cli/main.go @@ -38,6 +38,7 @@ var ( logJSON = flag.Bool("json", defaultLogJSON, "log in JSON format instead of text") logLevel = flag.String("loglevel", defaultLogLevel, "minimum loglevel: trace, debug, info, warn/warning, error, fatal, panic") logDebug = flag.Bool("debug", false, "shorthand for '-loglevel debug'") + logService = flag.String("log-service", "", "add a 'service=...' tag to all log messages") listenAddr = flag.String("addr", defaultListenAddr, "listen-address for mev-boost server") relayURLs = flag.String("relays", "", "relay urls - single entry or comma-separated list (scheme://pubkey@host)") @@ -86,6 +87,9 @@ func Main() { } logrus.SetLevel(lvl) } + if *logService != "" { + log = log.WithField("service", *logService) + } log.Infof("mev-boost %s", config.Version) log.Debug("debug logging enabled")