// NewJournalWriter wraps "io.Writer" to redirect log output // to the local systemd journal. If journald send fails, it fails // back to writing to the original writer. // The decode overhead is only <30µs per write. // Reference: https://github.com/coreos/pkg/blob/master/capnslog/journald_formatter.go func NewJournalWriter(wr io.Writer) (io.Writer, error) { … } type journalWriter … type logLine … func (w *journalWriter) Write(p []byte) (int, error) { … }