revid/config.go: not breaking logging lines

This commit is contained in:
Saxon 2019-05-06 15:59:41 +09:30
parent 5c40c48e97
commit b3775265e6
1 changed files with 8 additions and 17 deletions

View File

@ -168,15 +168,13 @@ func (c *Config) Validate(r *Revid) error {
case logger.Fatal: case logger.Fatal:
default: default:
c.LogLevel = defaultVerbosity c.LogLevel = defaultVerbosity
c.Logger.Log(logger.Info, pkg+"bad LogLevel mode defined, defaulting", c.Logger.Log(logger.Info, pkg+"bad LogLevel mode defined, defaulting", "LogLevel", defaultVerbosity)
"LogLevel", defaultVerbosity)
} }
switch c.Input { switch c.Input {
case Raspivid, V4L, File: case Raspivid, V4L, File:
case NothingDefined: case NothingDefined:
c.Logger.Log(logger.Info, pkg+"no input type defined, defaulting", "input", c.Logger.Log(logger.Info, pkg+"no input type defined, defaulting", "input", defaultInput)
defaultInput)
c.Input = defaultInput c.Input = defaultInput
default: default:
return errors.New("bad input type defined in config") return errors.New("bad input type defined in config")
@ -200,20 +198,16 @@ func (c *Config) Validate(r *Revid) error {
} }
case NothingDefined: case NothingDefined:
c.Logger.Log(logger.Info, pkg+"no input codec defined, defaulting", c.Logger.Log(logger.Info, pkg+"no input codec defined, defaulting", "inputCodec", defaultInputCodec)
"inputCodec", defaultInputCodec)
c.InputCodec = defaultInputCodec c.InputCodec = defaultInputCodec
c.Logger.Log(logger.Info, pkg+"defaulting quantization", "quantization", c.Logger.Log(logger.Info, pkg+"defaulting quantization", "quantization", defaultQuantization)
defaultQuantization)
c.Quantization = defaultQuantization c.Quantization = defaultQuantization
default: default:
return errors.New("bad input codec defined in config") return errors.New("bad input codec defined in config")
} }
if c.Outputs == nil { if c.Outputs == nil {
c.Logger.Log(logger.Info, pkg+"no output defined, defaulting", "output", c.Logger.Log(logger.Info, pkg+"no output defined, defaulting", "output", defaultOutput)
defaultOutput)
c.Outputs = append(c.Outputs, defaultOutput) c.Outputs = append(c.Outputs, defaultOutput)
c.Packetization = defaultPacketization c.Packetization = defaultPacketization
} else { } else {
@ -229,14 +223,12 @@ func (c *Config) Validate(r *Revid) error {
// c.FramesPerClip = httpFramesPerClip // c.FramesPerClip = httpFramesPerClip
break break
} }
c.Logger.Log(logger.Info, pkg+"defaulting frames per clip for rtmp out", c.Logger.Log(logger.Info, pkg+"defaulting frames per clip for rtmp out", "framesPerClip", defaultFramesPerClip)
"framesPerClip", defaultFramesPerClip)
c.FramesPerClip = defaultFramesPerClip c.FramesPerClip = defaultFramesPerClip
c.Packetization = Flv c.Packetization = Flv
c.SendRetry = true c.SendRetry = true
case Http, Rtp: case Http, Rtp:
c.Logger.Log(logger.Info, pkg+"defaulting frames per clip for http out", c.Logger.Log(logger.Info, pkg+"defaulting frames per clip for http out", "framesPerClip", httpFramesPerClip)
"framesPerClip", httpFramesPerClip)
c.FramesPerClip = httpFramesPerClip c.FramesPerClip = httpFramesPerClip
c.Packetization = Mpegts c.Packetization = Mpegts
default: default:
@ -251,8 +243,7 @@ func (c *Config) Validate(r *Revid) error {
} }
if c.FramesPerClip < 1 { if c.FramesPerClip < 1 {
c.Logger.Log(logger.Info, pkg+"no FramesPerClip defined, defaulting", c.Logger.Log(logger.Info, pkg+"no FramesPerClip defined, defaulting", "framesPerClip", defaultFramesPerClip)
"framesPerClip", defaultFramesPerClip)
c.FramesPerClip = defaultFramesPerClip c.FramesPerClip = defaultFramesPerClip
} }