feat(ffmpeg): logging callback handler
This commit is contained in:
parent
f11d2b351c
commit
57541418b9
6 changed files with 71 additions and 1 deletions
13
processor.go
13
processor.go
|
|
@ -29,6 +29,19 @@ func NewProcessor(options ...Option) *Processor {
|
|||
}
|
||||
|
||||
func (p *Processor) Startup(_ context.Context) error {
|
||||
ffmpeg.SetLogging(func(level ffmpeg.AVLogLevel, message string) {
|
||||
message = strings.TrimSuffix(message, "\n")
|
||||
switch level {
|
||||
case ffmpeg.AVLogTrace, ffmpeg.AVLogDebug, ffmpeg.AVLogVerbose:
|
||||
p.Logger.Debug("ffmpeg", zap.String("msg", message))
|
||||
case ffmpeg.AVLogInfo:
|
||||
p.Logger.Info("ffmpeg", zap.String("msg", message))
|
||||
case ffmpeg.AVLogWarning:
|
||||
p.Logger.Warn("ffmpeg", zap.String("msg", message))
|
||||
case ffmpeg.AVLogError, ffmpeg.AVLogFatal, ffmpeg.AVLogPanic:
|
||||
p.Logger.Error("ffmpeg", zap.String("msg", message))
|
||||
}
|
||||
})
|
||||
if p.Debug {
|
||||
ffmpeg.SetFFmpegLogLevel(ffmpeg.AVLogDebug)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue