Skip to content

Commit

Permalink
Merge pull request #55 from taobig/fix-help-doc
Browse files Browse the repository at this point in the history
Ensure that the name of the log file is consistent in the help doc and in the code
  • Loading branch information
maoueh authored Sep 6, 2024
2 parents f22dd8c + 0b5a1d9 commit f1e7c25
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 @@ -73,7 +73,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 f1e7c25

Please sign in to comment.