Added Ping method to the logger class

This commit is contained in:
2025-10-12 19:17:17 +02:00
parent 69797a214f
commit e16021ee49

View File

@@ -1,7 +1,6 @@
package fluentd
import (
"errors"
"fmt"
"log"
@@ -38,11 +37,15 @@ func (l *Logger) Log(format string, v ...any) {
}
func (l *Logger) Ping() error {
if l.fluent.RequestAck {
return nil
mapData := map[string]string{
"message": "Checking is Fluentd alive",
}
err := l.fluent.Post(l.appName, mapData)
if err != nil {
return err
}
return errors.New("Logger service is unavailable")
return nil
}
func (l *Logger) Close() error {