From 66f9443b7d77eefebc6a3e66a774705eada351a1 Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Fri, 25 Aug 2023 16:06:18 +0200 Subject: [PATCH] client: log debug and error messages by default (#86) --- client.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/client.go b/client.go index d631c24..cedc537 100644 --- a/client.go +++ b/client.go @@ -8,6 +8,7 @@ package gohlslib import ( "context" "fmt" + "log" "net/http" "net/url" "time" @@ -108,16 +109,24 @@ func (c *Client) Start() error { } } if c.OnDownloadPrimaryPlaylist == nil { - c.OnDownloadPrimaryPlaylist = func(_ string) {} + c.OnDownloadPrimaryPlaylist = func(u string) { + log.Printf("downloading primary playlist %v", u) + } } if c.OnDownloadStreamPlaylist == nil { - c.OnDownloadStreamPlaylist = func(_ string) {} + c.OnDownloadStreamPlaylist = func(u string) { + log.Printf("downloading stream playlist %v", u) + } } if c.OnDownloadSegment == nil { - c.OnDownloadSegment = func(_ string) {} + c.OnDownloadSegment = func(u string) { + log.Printf("downloading segment %v", u) + } } if c.OnDecodeError == nil { - c.OnDecodeError = func(_ error) {} + c.OnDecodeError = func(err error) { + log.Println(err.Error()) + } } var err error