prysm-pulse/monitoring/journald/journald_linux.go
Nishant Das 4862d57b13
Fix Broken Dependency (#12293)
* vendor in library

* comment

* lint

* lint
2023-04-17 12:22:34 +08:00

23 lines
463 B
Go

//go:build linux
package journald
import (
"io"
"github.com/coreos/go-systemd/journal"
"github.com/sirupsen/logrus"
)
// Enable adds the Journal hook if journal is enabled
// Sets log output to ioutil.Discard so stdout isn't captured.
func Enable() error {
if !journal.Enabled() {
logrus.Warning("Journal not available but user requests we log to it. Ignoring")
} else {
logrus.AddHook(&JournalHook{})
logrus.SetOutput(io.Discard)
}
return nil
}