Browse Source

correctly set up and document verbose logging by default

main
forest 2 months ago
parent
commit
d1b7e14f06
2 changed files with 21 additions and 2 deletions
  1. +2
    -2
      cmd/webmentiond/main.go
  2. +19
    -0
      docs/configuration.md

+ 2
- 2
cmd/webmentiond/main.go View File

@ -21,7 +21,7 @@ func newRootCmd() Command {
Run: func(cmd *cobra.Command, args []string) {
},
PersistentPreRun: func(cmd *cobra.Command, args []string) {
logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger().Level(zerolog.DebugLevel)
logger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr}).With().Timestamp().Logger().Level(zerolog.InfoLevel)
if configFilePath != "" {
cfg.SetConfigFile(configFilePath)
if err := cfg.ReadInConfig(); err != nil {
@ -34,7 +34,7 @@ func newRootCmd() Command {
},
}
rootCmd.PersistentFlags().StringVar(&configFilePath, "config-file", "", "Path to a configuration file")
rootCmd.PersistentFlags().BoolVar(&verbose, "verbose", false, "Verbose output")
rootCmd.PersistentFlags().BoolVar(&verbose, "verbose", true, "Verbose output")
cfg.BindPFlag("verbose", rootCmd.PersistentFlags().Lookup("verbose"))
return newBaseCommand(rootCmd)
}


+ 19
- 0
docs/configuration.md View File

@ -3,9 +3,28 @@
Webmentiond can be configured through a handful of flags and environment
variables. This page will give you an overview of all of them:
## Main command flags
Flags that must be provided directly after the main `webmentiond` command.
### `--verbose BOOLEAN` (flag)
If true, set the log level to Debug. Otherwise leave it at Info.
Default: `true`
### `--config-file PATH` (flag)
Path to a config file.
Default: `null`
## Server settings
Allof the following flags go on the "webmentiond serve" command.
### `--addr ADDR` (flag)
This is the network address the server should listen to for requests.


Loading…
Cancel
Save