generated from TrueCloudLab/basic
.forgejo: Add pre-commit #7
2 changed files with 8 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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++
|
||||
|
|
Loading…
Reference in a new issue