From 8de5cb2f4a0ea05eac89524c6aed138fd42a5cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 5 Dec 2021 21:33:30 +0100 Subject: [PATCH] fix gst log. --- internal/capture/gst/gst.go | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/internal/capture/gst/gst.go b/internal/capture/gst/gst.go index 6d534e54..b4b0238e 100644 --- a/internal/capture/gst/gst.go +++ b/internal/capture/gst/gst.go @@ -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) }