mirror of https://bitbucket.org/ausocean/av.git
revid: added pkg name to logging messages in config.go
This commit is contained in:
parent
5e186a7941
commit
5c94f556b4
|
@ -104,6 +104,8 @@ const (
|
||||||
defaultVerbosity = No
|
defaultVerbosity = No
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const pkg = "revid: "
|
||||||
|
|
||||||
// Validate checks for any errors in the config fields and defaults settings
|
// Validate checks for any errors in the config fields and defaults settings
|
||||||
// if particular parameters have not been defined.
|
// if particular parameters have not been defined.
|
||||||
func (c *Config) Validate(r *Revid) error {
|
func (c *Config) Validate(r *Revid) error {
|
||||||
|
@ -112,7 +114,7 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
case No:
|
case No:
|
||||||
case NothingDefined:
|
case NothingDefined:
|
||||||
c.Verbosity = defaultVerbosity
|
c.Verbosity = defaultVerbosity
|
||||||
c.Logger.Log(smartlogger.Warning, "No verbosity mode defined, defaulting",
|
c.Logger.Log(smartlogger.Warning, pkg+"No verbosity mode defined, defaulting",
|
||||||
"verbosity", defaultVerbosity)
|
"verbosity", defaultVerbosity)
|
||||||
default:
|
default:
|
||||||
return errors.New("Bad Verbosity defined in config!")
|
return errors.New("Bad Verbosity defined in config!")
|
||||||
|
@ -122,7 +124,7 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
case QuantizationOn:
|
case QuantizationOn:
|
||||||
case QuantizationOff:
|
case QuantizationOff:
|
||||||
case NothingDefined:
|
case NothingDefined:
|
||||||
c.Logger.Log(smartlogger.Warning, "No quantization mode defined, defaulting",
|
c.Logger.Log(smartlogger.Warning, pkg+"No quantization mode defined, defaulting",
|
||||||
"quantizationMode", QuantizationOff)
|
"quantizationMode", QuantizationOff)
|
||||||
c.QuantizationMode = QuantizationOff
|
c.QuantizationMode = QuantizationOff
|
||||||
default:
|
default:
|
||||||
|
@ -133,7 +135,7 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
case Raspivid:
|
case Raspivid:
|
||||||
case File:
|
case File:
|
||||||
case NothingDefined:
|
case NothingDefined:
|
||||||
c.Logger.Log(smartlogger.Warning, "No input type defined, defaulting", "input",
|
c.Logger.Log(smartlogger.Warning, pkg+"No input type defined, defaulting", "input",
|
||||||
defaultInput)
|
defaultInput)
|
||||||
c.Input = defaultInput
|
c.Input = defaultInput
|
||||||
default:
|
default:
|
||||||
|
@ -166,10 +168,10 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case NothingDefined:
|
case NothingDefined:
|
||||||
c.Logger.Log(smartlogger.Warning, "No input codec defined, defaulting",
|
c.Logger.Log(smartlogger.Warning, pkg+"No input codec defined, defaulting",
|
||||||
"inputCodec", defaultInputCodec)
|
"inputCodec", defaultInputCodec)
|
||||||
c.InputCodec = defaultInputCodec
|
c.InputCodec = defaultInputCodec
|
||||||
c.Logger.Log(smartlogger.Warning, "Defaulting quantization", "quantization",
|
c.Logger.Log(smartlogger.Warning, pkg+"Defaulting quantization", "quantization",
|
||||||
defaultQuantization)
|
defaultQuantization)
|
||||||
c.Quantization = defaultQuantization
|
c.Quantization = defaultQuantization
|
||||||
default:
|
default:
|
||||||
|
@ -180,20 +182,20 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
case File:
|
case File:
|
||||||
case Rtmp, FfmpegRtmp:
|
case Rtmp, FfmpegRtmp:
|
||||||
if c.RtmpUrl == "" {
|
if c.RtmpUrl == "" {
|
||||||
c.Logger.Log(smartlogger.Info, "No RTMP URL: falling back to HTTP")
|
c.Logger.Log(smartlogger.Info, pkg+"No RTMP URL: falling back to HTTP")
|
||||||
c.Output = Http
|
c.Output = Http
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
c.Logger.Log(smartlogger.Info, "Defaulting frames per clip for rtmp out",
|
c.Logger.Log(smartlogger.Info, pkg+"Defaulting frames per clip for rtmp out",
|
||||||
"framesPerClip", defaultFramesPerClip)
|
"framesPerClip", defaultFramesPerClip)
|
||||||
c.FramesPerClip = defaultFramesPerClip
|
c.FramesPerClip = defaultFramesPerClip
|
||||||
case NothingDefined:
|
case NothingDefined:
|
||||||
c.Logger.Log(smartlogger.Warning, "No output defined, defaulting", "output",
|
c.Logger.Log(smartlogger.Warning, pkg+"No output defined, defaulting", "output",
|
||||||
defaultOutput)
|
defaultOutput)
|
||||||
c.Output = defaultOutput
|
c.Output = defaultOutput
|
||||||
fallthrough
|
fallthrough
|
||||||
case Http:
|
case Http:
|
||||||
c.Logger.Log(smartlogger.Info, "Defaulting frames per clip for http out",
|
c.Logger.Log(smartlogger.Info, pkg+"Defaulting frames per clip for http out",
|
||||||
"framesPerClip", httpFramesPerClip)
|
"framesPerClip", httpFramesPerClip)
|
||||||
c.FramesPerClip = httpFramesPerClip
|
c.FramesPerClip = httpFramesPerClip
|
||||||
default:
|
default:
|
||||||
|
@ -205,7 +207,7 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
case Mpegts:
|
case Mpegts:
|
||||||
case Flv:
|
case Flv:
|
||||||
case NothingDefined:
|
case NothingDefined:
|
||||||
c.Logger.Log(smartlogger.Warning, "No packetization option defined, defaulting",
|
c.Logger.Log(smartlogger.Warning, pkg+"No packetization option defined, defaulting",
|
||||||
"packetization", defaultPacketization)
|
"packetization", defaultPacketization)
|
||||||
c.Packetization = defaultPacketization
|
c.Packetization = defaultPacketization
|
||||||
default:
|
default:
|
||||||
|
@ -216,7 +218,7 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
case Yes:
|
case Yes:
|
||||||
case No:
|
case No:
|
||||||
case NothingDefined:
|
case NothingDefined:
|
||||||
c.Logger.Log(smartlogger.Warning, "No horizontal flip option defined, defaulting",
|
c.Logger.Log(smartlogger.Warning, pkg+"No horizontal flip option defined, defaulting",
|
||||||
"horizontalFlip", defaultHorizontalFlip)
|
"horizontalFlip", defaultHorizontalFlip)
|
||||||
c.HorizontalFlip = defaultHorizontalFlip
|
c.HorizontalFlip = defaultHorizontalFlip
|
||||||
default:
|
default:
|
||||||
|
@ -227,7 +229,7 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
case Yes:
|
case Yes:
|
||||||
case No:
|
case No:
|
||||||
case NothingDefined:
|
case NothingDefined:
|
||||||
c.Logger.Log(smartlogger.Warning, "No vertical flip option defined, defaulting",
|
c.Logger.Log(smartlogger.Warning, pkg+"No vertical flip option defined, defaulting",
|
||||||
"verticalFlip", defaultVerticalFlip)
|
"verticalFlip", defaultVerticalFlip)
|
||||||
c.VerticalFlip = defaultVerticalFlip
|
c.VerticalFlip = defaultVerticalFlip
|
||||||
default:
|
default:
|
||||||
|
@ -235,13 +237,13 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.FramesPerClip < 1 {
|
if c.FramesPerClip < 1 {
|
||||||
c.Logger.Log(smartlogger.Warning, "No FramesPerClip defined, defaulting",
|
c.Logger.Log(smartlogger.Warning, pkg+"No FramesPerClip defined, defaulting",
|
||||||
"framesPerClip", defaultFramesPerClip)
|
"framesPerClip", defaultFramesPerClip)
|
||||||
c.FramesPerClip = defaultFramesPerClip
|
c.FramesPerClip = defaultFramesPerClip
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Width == "" {
|
if c.Width == "" {
|
||||||
c.Logger.Log(smartlogger.Warning, "No width defined, defaulting", "width",
|
c.Logger.Log(smartlogger.Warning, pkg+"No width defined, defaulting", "width",
|
||||||
defaultWidth)
|
defaultWidth)
|
||||||
c.Width = defaultWidth
|
c.Width = defaultWidth
|
||||||
} else {
|
} else {
|
||||||
|
@ -251,7 +253,7 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Height == "" {
|
if c.Height == "" {
|
||||||
c.Logger.Log(smartlogger.Warning, "No height defined, defaulting", "height",
|
c.Logger.Log(smartlogger.Warning, pkg+"No height defined, defaulting", "height",
|
||||||
defaultHeight)
|
defaultHeight)
|
||||||
c.Height = defaultHeight
|
c.Height = defaultHeight
|
||||||
} else {
|
} else {
|
||||||
|
@ -261,7 +263,7 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.FrameRate == "" {
|
if c.FrameRate == "" {
|
||||||
c.Logger.Log(smartlogger.Warning, "No frame rate defined, defaulting", "fps",
|
c.Logger.Log(smartlogger.Warning, pkg+"No frame rate defined, defaulting", "fps",
|
||||||
defaultFrameRate)
|
defaultFrameRate)
|
||||||
c.FrameRate = defaultFrameRate
|
c.FrameRate = defaultFrameRate
|
||||||
} else {
|
} else {
|
||||||
|
@ -271,7 +273,7 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Bitrate == "" {
|
if c.Bitrate == "" {
|
||||||
c.Logger.Log(smartlogger.Warning, "No bitrate defined, defaulting", "bitrate",
|
c.Logger.Log(smartlogger.Warning, pkg+"No bitrate defined, defaulting", "bitrate",
|
||||||
defaultBitrate)
|
defaultBitrate)
|
||||||
c.Bitrate = defaultBitrate
|
c.Bitrate = defaultBitrate
|
||||||
} else {
|
} else {
|
||||||
|
@ -281,7 +283,7 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Timeout == "" {
|
if c.Timeout == "" {
|
||||||
c.Logger.Log(smartlogger.Warning, "No timeout defined, defaulting", "timeout", defaultTimeout)
|
c.Logger.Log(smartlogger.Warning, pkg+"No timeout defined, defaulting", "timeout", defaultTimeout)
|
||||||
c.Timeout = defaultTimeout
|
c.Timeout = defaultTimeout
|
||||||
} else {
|
} else {
|
||||||
if integer, err := strconv.Atoi(c.Timeout); integer < 0 || err != nil {
|
if integer, err := strconv.Atoi(c.Timeout); integer < 0 || err != nil {
|
||||||
|
@ -290,7 +292,7 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.IntraRefreshPeriod == "" {
|
if c.IntraRefreshPeriod == "" {
|
||||||
c.Logger.Log(smartlogger.Warning, "No intra refresh defined, defaulting", "intraRefresh",
|
c.Logger.Log(smartlogger.Warning, pkg+"No intra refresh defined, defaulting", "intraRefresh",
|
||||||
defaultIntraRefreshPeriod)
|
defaultIntraRefreshPeriod)
|
||||||
c.IntraRefreshPeriod = defaultIntraRefreshPeriod
|
c.IntraRefreshPeriod = defaultIntraRefreshPeriod
|
||||||
} else {
|
} else {
|
||||||
|
@ -300,7 +302,7 @@ func (c *Config) Validate(r *Revid) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Quantization == "" {
|
if c.Quantization == "" {
|
||||||
c.Logger.Log(smartlogger.Warning, "No quantization defined, defaulting", "quantization",
|
c.Logger.Log(smartlogger.Warning, pkg+"No quantization defined, defaulting", "quantization",
|
||||||
defaultQuantization)
|
defaultQuantization)
|
||||||
c.Quantization = defaultQuantization
|
c.Quantization = defaultQuantization
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue