mirror of https://bitbucket.org/ausocean/av.git
Merged in logging-var (pull request #192)
revid: logging is now checked as a valid device variable so that logging level may be changed remotely
This commit is contained in:
commit
7e4cc82e35
2
go.sum
2
go.sum
|
@ -1,7 +1,5 @@
|
||||||
bitbucket.org/ausocean/iot v1.2.4 h1:M/473iQ0d4q+76heerjAQuqXzQyc5dZ3F7Bfuq6X7q4=
|
bitbucket.org/ausocean/iot v1.2.4 h1:M/473iQ0d4q+76heerjAQuqXzQyc5dZ3F7Bfuq6X7q4=
|
||||||
bitbucket.org/ausocean/iot v1.2.4/go.mod h1:5HVLgPHccW2PxS7WDUQO6sKWMgk3Vfze/7d5bHs8EWU=
|
bitbucket.org/ausocean/iot v1.2.4/go.mod h1:5HVLgPHccW2PxS7WDUQO6sKWMgk3Vfze/7d5bHs8EWU=
|
||||||
bitbucket.org/ausocean/utils v0.0.0-20190408050157-66d3b4d4041e h1:rn7Z1vE6m1NSH+mrPJPgquEfBDsqzBEH4Y6fxzyB6kA=
|
|
||||||
bitbucket.org/ausocean/utils v0.0.0-20190408050157-66d3b4d4041e/go.mod h1:uXzX9z3PLemyURTMWRhVI8uLhPX4uuvaaO85v2hcob8=
|
|
||||||
bitbucket.org/ausocean/utils v1.2.6 h1:JN66APCV+hu6GebIHSu2KSywhLym4vigjSz5+fB0zXc=
|
bitbucket.org/ausocean/utils v1.2.6 h1:JN66APCV+hu6GebIHSu2KSywhLym4vigjSz5+fB0zXc=
|
||||||
bitbucket.org/ausocean/utils v1.2.6/go.mod h1:uXzX9z3PLemyURTMWRhVI8uLhPX4uuvaaO85v2hcob8=
|
bitbucket.org/ausocean/utils v1.2.6/go.mod h1:uXzX9z3PLemyURTMWRhVI8uLhPX4uuvaaO85v2hcob8=
|
||||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||||
|
|
|
@ -148,7 +148,7 @@ const (
|
||||||
defaultFramesPerClip = 1
|
defaultFramesPerClip = 1
|
||||||
httpFramesPerClip = 560
|
httpFramesPerClip = 560
|
||||||
defaultInputCodec = H264
|
defaultInputCodec = H264
|
||||||
defaultVerbosity = No // FIXME(kortschak): This makes no sense whatsoever. No is currently 15.
|
defaultVerbosity = logger.Error
|
||||||
defaultRtpAddr = "localhost:6970"
|
defaultRtpAddr = "localhost:6970"
|
||||||
defaultBurstPeriod = 10 // Seconds
|
defaultBurstPeriod = 10 // Seconds
|
||||||
defaultRotation = 0 // Degrees
|
defaultRotation = 0 // Degrees
|
||||||
|
@ -161,14 +161,15 @@ const (
|
||||||
// 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 {
|
||||||
switch c.LogLevel {
|
switch c.LogLevel {
|
||||||
case Yes:
|
case logger.Debug:
|
||||||
case No:
|
case logger.Info:
|
||||||
case NothingDefined:
|
case logger.Warning:
|
||||||
c.LogLevel = defaultVerbosity
|
case logger.Error:
|
||||||
c.Logger.Log(logger.Info, pkg+"no LogLevel mode defined, defaulting",
|
case logger.Fatal:
|
||||||
"LogLevel", defaultVerbosity)
|
|
||||||
default:
|
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 {
|
switch c.Input {
|
||||||
|
|
|
@ -155,6 +155,8 @@ func (r *Revid) reset(config Config) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r.config.Logger.SetLevel(config.LogLevel)
|
||||||
|
|
||||||
err = r.setupPipeline(
|
err = r.setupPipeline(
|
||||||
func(dst io.WriteCloser, fps int) (io.WriteCloser, error) {
|
func(dst io.WriteCloser, fps int) (io.WriteCloser, error) {
|
||||||
e := mts.NewEncoder(dst, float64(fps), mts.Video)
|
e := mts.NewEncoder(dst, float64(fps), mts.Video)
|
||||||
|
@ -448,6 +450,21 @@ func (r *Revid) Update(vars map[string]string) error {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
r.config.BurstPeriod = uint(v)
|
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))
|
r.config.Logger.Log(logger.Info, pkg+"revid config changed", "config", fmt.Sprintf("%+v", r.config))
|
||||||
|
|
Loading…
Reference in New Issue