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++