fix gst log.

This commit is contained in:
Miroslav Šedivý 2021-12-05 21:33:30 +01:00
parent f9fe303b50
commit 8de5cb2f4a

View File

@ -135,7 +135,8 @@ func goHandlePipelineBuffer(buffer unsafe.Pointer, bufferLen C.int, duration C.i
log.Warn().
Str("module", "capture").
Str("submodule", "gstreamer").
Msgf("discarding sample, no pipeline with id %d", int(pipelineID))
Int("pipeline-id", int(pipelineID)).
Msgf("discarding sample, pipeline not found")
}
}
@ -144,21 +145,10 @@ func goPipelineLog(levelUnsafe *C.char, msgUnsafe *C.char, pipelineID C.int) {
levelStr := C.GoString(levelUnsafe)
msg := C.GoString(msgUnsafe)
logger := log.With().
level, _ := zerolog.ParseLevel(levelStr)
log.WithLevel(level).
Str("module", "capture").
Str("submodule", "gstreamer").
Logger()
pipelinesLock.Lock()
pipeline, ok := pipelines[int(pipelineID)]
pipelinesLock.Unlock()
if ok {
logger = logger.With().
Int("id", pipeline.id).
Logger()
}
level, _ := zerolog.ParseLevel(levelStr)
logger.WithLevel(level).Msg(msg)
Int("pipeline-id", int(pipelineID)).
Msg(msg)
}