Closed xiongchuan86 closed 3 years ago
you should write a adapter for logger which implement writer interface, example:
type LogAdapter struct{}
func (l *LogAdapter) Write(p []byte) (n int, err error) {
log.Printf("%s", string(p))
return len(p), nil
}
func TestWithLogger(t *testing.T) {
err := ffmpeg.Input("./sample_data/in1.mp4", ffmpeg.KwArgs{"ss": "1"}).
Output("./sample_data/out1.gif", ffmpeg.KwArgs{"s": "320x240", "pix_fmt": "rgb24", "t": "3", "r": "3"}).
OverWriteOutput().WithOutput(&LogAdapter{}, &LogAdapter{}).Run()
assert.Nil(t, err)
}
I want to get output(stdout,stderr) from a log file