Adds omitempty to several configuration fields

Includes deprecated Loglevel, Log.Formatter, and Log.Fields
This commit is contained in:
Brian Bland 2015-04-07 17:39:20 -07:00
parent 5fe1039947
commit 5955c73db7
2 changed files with 5 additions and 5 deletions

View file

@ -24,16 +24,16 @@ type Configuration struct {
// Formatter overrides the default formatter with another. Options // Formatter overrides the default formatter with another. Options
// include "text", "json" and "logstash". // include "text", "json" and "logstash".
Formatter string `yaml:"formatter"` Formatter string `yaml:"formatter,omitempty"`
// Fields allows users to specify static string fields to include in // Fields allows users to specify static string fields to include in
// the logger context. // the logger context.
Fields map[string]interface{} `yaml:"fields"` Fields map[string]interface{} `yaml:"fields,omitempty"`
} }
// Loglevel is the level at which registry operations are logged. This is // Loglevel is the level at which registry operations are logged. This is
// deprecated. Please use Log.Level in the future. // deprecated. Please use Log.Level in the future.
Loglevel Loglevel `yaml:"loglevel"` Loglevel Loglevel `yaml:"loglevel,omitempty"`
// Storage is the configuration for the registry's storage driver // Storage is the configuration for the registry's storage driver
Storage Storage `yaml:"storage"` Storage Storage `yaml:"storage"`

View file

@ -18,8 +18,8 @@ var configStruct = Configuration{
Version: "0.1", Version: "0.1",
Log: struct { Log: struct {
Level Loglevel `yaml:"level"` Level Loglevel `yaml:"level"`
Formatter string `yaml:"formatter"` Formatter string `yaml:"formatter,omitempty"`
Fields map[string]interface{} `yaml:"fields"` Fields map[string]interface{} `yaml:"fields,omitempty"`
}{ }{
Fields: map[string]interface{}{"environment": "test"}, Fields: map[string]interface{}{"environment": "test"},
}, },