journalhook

package module
v0.0.0-...-5d0a5ae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2018 License: MIT Imports: 5 Imported by: 25

README

journalhook

systemd-journald hook for logrus

wercker status

Use

import "github.com/wercker/journalhook"

journalhook.Enable()

Note that this will discard all journal output. Generally when logging to the journal, your application will be managed by systemd, which will automatically capture command output and send it to the journal. This way we preempt that potential log message duplication.

If you'd like not to do that, it's as easy as:


import (
    "github.com/wercker/journalhook"
    "github.com/sirupsen/logrus"
)

logrus.AddHook(&journalhook.JournalHook{})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enable

func Enable()

Adds the Journal hook if journal is enabled Sets log output to ioutil.Discard so stdout isn't captured.

Types

type JournalHook

type JournalHook struct{}

func (*JournalHook) Fire

func (hook *JournalHook) Fire(entry *logrus.Entry) error

func (*JournalHook) Levels

func (hook *JournalHook) Levels() []logrus.Level

`Levels()` returns a slice of `Levels` the hook is fired for.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL