f-29: watchdog: add notify #29
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
9445bc087a
commit
f05c4e1fce
3 changed files with 149 additions and 0 deletions
24
internal/watchdog/notify/stderr.go
Normal file
24
internal/watchdog/notify/stderr.go
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package notify
|
||||
|
||||
import "log/slog"
|
||||
|
||||
var _ Notifier = (*StderrNotifier)(nil)
|
||||
|
||||
type StderrNotifier struct {
|
||||
logger *slog.Logger
|
||||
}
|
||||
|
||||
func NewStderr(l *slog.Logger) *StderrNotifier {
|
||||
if l == nil {
|
||||
l = slog.Default()
|
||||
}
|
||||
return &StderrNotifier{logger: l}
|
||||
}
|
||||
|
||||
func (n *StderrNotifier) Notify(kind, name, problem string) {
|
||||
n.logger.Error("watchdog: incohérence détectée",
|
||||
"kind", kind,
|
||||
"name", name,
|
||||
"problem", problem,
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue