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 package fluentd
import ( import (
"errors"
"fmt" "fmt"
"log" "log"
@@ -38,11 +37,15 @@ func (l *Logger) Log(format string, v ...any) {
} }
func (l *Logger) Ping() error { func (l *Logger) Ping() error {
if l.fluent.RequestAck { mapData := map[string]string{
return nil "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 { func (l *Logger) Close() error {