Skip to content

Commit

Permalink
Ensure that the name of the log file is consistent in the help doc an…
Browse files Browse the repository at this point in the history
…d in the code.
  • Loading branch information
taobig committed Aug 16, 2024
1 parent ad3d137 commit 0b5a1d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func Main[B firecore.Block](chain *firecore.Chain[B]) {
flags.StringP("config-file", "c", "./firehose.yaml", "Configuration file to use. No config file loaded if set to an empty string.")

flags.String("log-format", "text", "Format for logging to stdout. Either 'text' or 'stackdriver'")
flags.Bool("log-to-file", true, "Also write logs to {data-dir}/firehose.log.json ")
flags.Bool("log-to-file", true, fmt.Sprintf("Also write logs to {data-dir}/%s ", launcher.DefaultLogFile))
flags.String("log-level-switcher-listen-addr", "localhost:1065", cli.FlagDescription(`
If non-empty, a JSON based HTTP server will listen on this address to let you switch the default logging level
of all registered loggers to a different one on the fly. This enables switching to debug level on
Expand Down
4 changes: 3 additions & 1 deletion launcher/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import (
"go.uber.org/zap"
)

const DefaultLogFile = "app.log.json"

type LoggingOptions struct {
WorkingDir string // the folder where the data will be stored, in our case will be used to store the logger
Verbosity int // verbosity level
Expand Down Expand Up @@ -50,7 +52,7 @@ func SetupLogger(rootLogger *zap.Logger, opts *LoggingOptions) {
}

if opts.LogToFile {
options = append(options, logging.WithOutputToFile(filepath.Join(opts.WorkingDir, "app.log.json")))
options = append(options, logging.WithOutputToFile(filepath.Join(opts.WorkingDir, DefaultLogFile)))
}

logging.InstantiateLoggers(options...)
Expand Down

0 comments on commit 0b5a1d9

Please sign in to comment.