mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
4862d57b13
* vendor in library * comment * lint * lint
23 lines
463 B
Go
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
|
|
}
|