Added Ping method to the logger class
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user