mirror of https://bitbucket.org/ausocean/av.git
revid: logging is now checked as a valid device so that logging level may be changed remotely
This commit is contained in:
parent
b4ff40e269
commit
ec290f1058
|
@ -148,7 +148,7 @@ const (
|
|||
defaultFramesPerClip = 1
|
||||
httpFramesPerClip = 560
|
||||
defaultInputCodec = H264
|
||||
defaultVerbosity = No // FIXME(kortschak): This makes no sense whatsoever. No is currently 15.
|
||||
defaultVerbosity = logger.Error
|
||||
defaultRtpAddr = "localhost:6970"
|
||||
defaultBurstPeriod = 10 // Seconds
|
||||
defaultRotation = 0 // Degrees
|
||||
|
@ -161,14 +161,15 @@ const (
|
|||
// if particular parameters have not been defined.
|
||||
func (c *Config) Validate(r *Revid) error {
|
||||
switch c.LogLevel {
|
||||
case Yes:
|
||||
case No:
|
||||
case NothingDefined:
|
||||
c.LogLevel = defaultVerbosity
|
||||
c.Logger.Log(logger.Info, pkg+"no LogLevel mode defined, defaulting",
|
||||
"LogLevel", defaultVerbosity)
|
||||
case logger.Debug:
|
||||
case logger.Info:
|
||||
case logger.Warning:
|
||||
case logger.Error:
|
||||
case logger.Fatal:
|
||||
default:
|
||||
return errors.New("bad LogLevel defined in config")
|
||||
c.LogLevel = defaultVerbosity
|
||||
c.Logger.Log(logger.Info, pkg+"bad LogLevel mode defined, defaulting",
|
||||
"LogLevel", defaultVerbosity)
|
||||
}
|
||||
|
||||
switch c.Input {
|
||||
|
|
|
@ -155,6 +155,8 @@ func (r *Revid) reset(config Config) error {
|
|||
return err
|
||||
}
|
||||
|
||||
r.config.Logger.SetLevel(config.LogLevel)
|
||||
|
||||
err = r.setupPipeline(
|
||||
func(dst io.WriteCloser, fps int) (io.WriteCloser, error) {
|
||||
e := mts.NewEncoder(dst, float64(fps), mts.Video)
|
||||
|
@ -448,6 +450,21 @@ func (r *Revid) Update(vars map[string]string) error {
|
|||
break
|
||||
}
|
||||
r.config.BurstPeriod = uint(v)
|
||||
case "Logging":
|
||||
switch value {
|
||||
case "Debug":
|
||||
r.config.LogLevel = logger.Debug
|
||||
case "Info":
|
||||
r.config.LogLevel = logger.Info
|
||||
case "Warning":
|
||||
r.config.LogLevel = logger.Warning
|
||||
case "Error":
|
||||
r.config.LogLevel = logger.Error
|
||||
case "Fatal":
|
||||
r.config.LogLevel = logger.Fatal
|
||||
default:
|
||||
r.config.Logger.Log(logger.Warning, pkg+"invalid Logging param", "value", value)
|
||||
}
|
||||
}
|
||||
}
|
||||
r.config.Logger.Log(logger.Info, pkg+"revid config changed", "config", fmt.Sprintf("%+v", r.config))
|
||||
|
|
Loading…
Reference in New Issue