From 99465e6639bba893f1f06097c169808a32484833 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 31 Jan 2024 14:53:27 +0300 Subject: [PATCH] [#7] loki: Fix linter issues Signed-off-by: Evgenii Stratonikov --- logging/lokicore/loki/example/main.go | 7 ++++++- logging/lokicore/loki/log.go | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/logging/lokicore/loki/example/main.go b/logging/lokicore/loki/example/main.go index ce671cc..52051d3 100644 --- a/logging/lokicore/loki/example/main.go +++ b/logging/lokicore/loki/example/main.go @@ -1,6 +1,8 @@ package main import ( + "fmt" + "os" "strconv" "sync" "time" @@ -19,7 +21,10 @@ func send(loki *loki.Client) { for j := 0; j < countMsg/countMsgGroup; j++ { for i := 0; i < countMsgGroup; i++ { - loki.Send(strconv.Itoa(j)+" "+strconv.Itoa(i)+" test log message", time.Now()) + err := loki.Send(strconv.Itoa(j)+" "+strconv.Itoa(i)+" test log message", time.Now()) + if err != nil { + fmt.Fprintf(os.Stderr, "send: %v", err) + } } time.Sleep(20 * time.Millisecond) } diff --git a/logging/lokicore/loki/log.go b/logging/lokicore/loki/log.go index 9cafd53..680102a 100644 --- a/logging/lokicore/loki/log.go +++ b/logging/lokicore/loki/log.go @@ -6,8 +6,9 @@ import ( "time" ) +// Send sends the message to the loki server. // If the client is disabled, it returns error. -// If the entries channel is full, the message is discarded and returns error +// If the entries channel is full, the message is discarded and returns error. func (client *Client) Send(msg string, timestamp time.Time) error { if !client.IsEnabled() { client.missedMessages++