syslog

package
v1.5.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2019 License: Apache-2.0 Imports: 10 Imported by: 42

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = logrus.New()

Logger is the logger object used by the package

Functions

func MakeTag

func MakeTag(prefix, proc string) string

MakeTag returns prfeix + sep + proc if prefix is not empty. If proc is empty, proc is set to filepath.Base(os.Args[0]). If prefix is empty, MakeTag returns proc.

Types

type Format

type Format int

Format is the syslog format, e.g. RFC 3164

const (
	RFC3164 Format = iota
)

type Hook

type Hook struct {
	// contains filtered or unexported fields
}

func NewHook

func NewHook(network, raddr string, priority Priority, tag string) (*Hook, error)

func (*Hook) Fire

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

func (*Hook) Levels

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

type Priority

type Priority int

Priority is a combination of the syslog facility and severity. For example, Alert | Ftp sends an alert severity message from the FTP facility. The default severity is Emerg; the default facility is Kern.

const (

	// From /usr/include/sys/syslog.h.
	// These are the same on Linux, BSD, and OS X.
	Emerg   Priority = iota // LOG_EMERG
	Alert                   // LOG_ALERT
	Crit                    // LOG_CRIT
	Err                     // LOG_ERR
	Warning                 // LOG_WARNING
	Notice                  // LOG_NOTICE
	Info                    // LOG_INFO
	Debug                   // LOG_DEBUG
)
const (

	// From /usr/include/sys/syslog.h.
	// These are the same up to LOG_FTP on Linux, BSD, and OS X.
	Kern     Priority = iota << 3 // LOG_KERN
	User                          // LOG_USER
	Mail                          // LOG_MAIL
	Daemon                        // LOG_DAEMON
	Auth                          // LOG_AUTH
	Syslog                        // LOG_SYSLOG
	Lpr                           // LOG_LPR
	News                          // LOG_NEWS
	Uucp                          // LOG_UUCP
	Cron                          // LOG_CRON
	Authpriv                      // LOG_AUTHPRIV
	Ftp                           // LOG_FTP

	Local0 // LOG_LOCAL0
	Local1 // LOG_LOCAL1
	Local2 // LOG_LOCAL2
	Local3 // LOG_LOCAL3
	Local4 // LOG_LOCAL4
	Local5 // LOG_LOCAL5
	Local6 // LOG_LOCAL6
	Local7 // LOG_LOCAL7
)

type Writer

type Writer interface {
	io.WriteCloser

	Emerg(string) error
	Crit(string) error
	Err(string) error
	Warning(string) error
	Info(string) error
	Debug(string) error

	WithTag(tag string) Writer
	WithPriority(priority Priority) Writer
}

func Dial

func Dial(network, raddr string, priority Priority, tag string) (Writer, error)

Dial establishes a connection to a log daemon by connecting to address raddr on the specified network. Each write to the returned writer sends a log message with the given facility, severity and tag. If network is empty, Dial will connect to the local syslog server.

func New

func New(priority Priority, tag string) (Writer, error)

New establishes a new connection to the system log daemon. Each write to the returned writer sends a log message with the given priority and prefix.

Jump to

Keyboard shortcuts

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