mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-10-05 16:26:50 +08:00
Add log level for ffmpeg module
This commit is contained in:
@@ -120,7 +120,7 @@ func Init() {
|
|||||||
|
|
||||||
cfg.Mod = map[string]string{
|
cfg.Mod = map[string]string{
|
||||||
"format": "color",
|
"format": "color",
|
||||||
"level": zerolog.LevelInfoValue,
|
"level": "info",
|
||||||
"output": "stdout", // TODO: change to stderr someday
|
"output": "stdout", // TODO: change to stderr someday
|
||||||
"time": zerolog.TimeFormatUnixMs,
|
"time": zerolog.TimeFormatUnixMs,
|
||||||
}
|
}
|
||||||
|
@@ -19,15 +19,22 @@ import (
|
|||||||
func Init() {
|
func Init() {
|
||||||
var cfg struct {
|
var cfg struct {
|
||||||
Mod map[string]string `yaml:"ffmpeg"`
|
Mod map[string]string `yaml:"ffmpeg"`
|
||||||
|
Log struct {
|
||||||
|
Level string `yaml:"ffmpeg"`
|
||||||
|
} `yaml:"log"`
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.Mod = defaults // will be overriden from yaml
|
cfg.Mod = defaults // will be overriden from yaml
|
||||||
|
cfg.Log.Level = "error"
|
||||||
|
|
||||||
app.LoadConfig(&cfg)
|
app.LoadConfig(&cfg)
|
||||||
|
|
||||||
if app.GetLogger("exec").GetLevel() >= 0 {
|
// zerolog levels: trace debug info warn error fatal panic disabled
|
||||||
defaults["global"] += " -v error"
|
// FFmpeg levels: trace debug verbose info warning error fatal panic quiet
|
||||||
|
if cfg.Log.Level == "warn" {
|
||||||
|
cfg.Log.Level = "warning"
|
||||||
}
|
}
|
||||||
|
defaults["global"] += " -v " + cfg.Log.Level
|
||||||
|
|
||||||
streams.RedirectFunc("ffmpeg", func(url string) (string, error) {
|
streams.RedirectFunc("ffmpeg", func(url string) (string, error) {
|
||||||
if _, err := Version(); err != nil {
|
if _, err := Version(); err != nil {
|
||||||
|
Reference in New Issue
Block a user