1
0
Fork 0
forked from External/ergo

refactor logging to implement #142

This commit is contained in:
Shivaram Lingamneni 2017-10-01 23:31:40 -04:00 committed by Daniel Oaks
parent 23af746182
commit aff1752d67
4 changed files with 96 additions and 71 deletions

View file

@ -131,20 +131,6 @@ type ConnectionThrottleConfig struct {
Exempted []string
}
// LoggingConfig controls a single logging method.
type LoggingConfig struct {
Method string
MethodStdout bool
MethodStderr bool
MethodFile bool
Filename string
TypeString string `yaml:"type"`
Types []string `yaml:"real-types"`
ExcludedTypes []string `yaml:"real-excluded-types"`
LevelString string `yaml:"level"`
Level logger.Level `yaml:"level-real"`
}
// LineLenConfig controls line lengths.
type LineLenConfig struct {
Tags int
@ -219,7 +205,7 @@ type Config struct {
Opers map[string]*OperConfig
Logging []LoggingConfig
Logging []logger.LoggingConfig
Debug struct {
StackImpact StackImpactConfig
@ -431,7 +417,7 @@ func LoadConfig(filename string) (config *Config, err error) {
if config.Limits.LineLen.Tags < 512 || config.Limits.LineLen.Rest < 512 {
return nil, errors.New("Line lengths must be 512 or greater (check the linelen section under server->limits)")
}
var newLogConfigs []LoggingConfig
var newLogConfigs []logger.LoggingConfig
for _, logConfig := range config.Logging {
// methods
methods := make(map[string]bool)