mirror of
https://github.com/spf13/viper
synced 2025-05-11 06:37:27 +00:00
add DebugWith method for specifying where debug output should go
This commit is contained in:
parent
e34fb51dd7
commit
899b1be893
1 changed files with 13 additions and 7 deletions
20
viper.go
20
viper.go
|
@ -2005,11 +2005,17 @@ func (v *Viper) findConfigFile() (string, error) {
|
|||
// purposes.
|
||||
func Debug() { v.Debug() }
|
||||
func (v *Viper) Debug() {
|
||||
fmt.Printf("Aliases:\n%#v\n", v.aliases)
|
||||
fmt.Printf("Override:\n%#v\n", v.override)
|
||||
fmt.Printf("PFlags:\n%#v\n", v.pflags)
|
||||
fmt.Printf("Env:\n%#v\n", v.env)
|
||||
fmt.Printf("Key/Value Store:\n%#v\n", v.kvstore)
|
||||
fmt.Printf("Config:\n%#v\n", v.config)
|
||||
fmt.Printf("Defaults:\n%#v\n", v.defaults)
|
||||
v.DebugWith(os.Stdout)
|
||||
}
|
||||
|
||||
// DebugWith prints all configuration registries for debugging to the provided io.Writer.
|
||||
func DebugWith(w io.Writer) { v.DebugWith(w) }
|
||||
func (v *Viper) DebugWith(w io.Writer) {
|
||||
fmt.Fprintf(w, "Aliases:\n%#v\n", v.aliases)
|
||||
fmt.Fprintf(w, "Override:\n%#v\n", v.override)
|
||||
fmt.Fprintf(w, "PFlags:\n%#v\n", v.pflags)
|
||||
fmt.Fprintf(w, "Env:\n%#v\n", v.env)
|
||||
fmt.Fprintf(w, "Key/Value Store:\n%#v\n", v.kvstore)
|
||||
fmt.Fprintf(w, "Config:\n%#v\n", v.config)
|
||||
fmt.Fprintf(w, "Defaults:\n%#v\n", v.defaults)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue