syslogger

package
v0.0.0-...-1151264 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2019 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Delay

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

Delay is a syslogger.Syslogger that delays the initialization of another syslogger.Syslogger until the first time that Syslog is called.

func NewDelay

func NewDelay(cb func() (Syslogger, error)) (*Delay, error)

NewDelay gives a Delay syslogger.Syslogger given the callback function which will ultimately be used to create the real syslogger.Syslogger to be used.

func (*Delay) Syslog

func (d *Delay) Syslog(p pri.Priority, msg interface{}) error

Syslog logs messages. In the case of Delay, these messages are passed unaltered to another syslogger.Syslogger, and that syslogger.Syslogger would be created at this point if it had not already existed.

type Fallthrough

type Fallthrough struct {
	Default     Syslogger
	Fallthrough Syslogger
}

Fallthrough is a syslogger.Syslogger that logs to a backup syslogger.Sylogger in the event that there is trouble logging to the default syslogger.Syslogger.

func (*Fallthrough) Syslog

func (f *Fallthrough) Syslog(p pri.Priority, msg interface{}) error

Syslog logs a message. In the case of a Fallthrough, an attempt will be made to log to a default syslogger.Syslogger, then if that fails an attempt will be made to log to a fallthrough syslogger.Sylogger, then if that fails an error is returned.

type HumanReadable

type HumanReadable struct {
	Syslogger Syslogger
	Ident     string
	Facility  pri.Priority
	Pid       bool
}

HumanReadable is a syslogger.Syslogger that will format the message in a human readable way before passing the modified message to another syslogger.Syslogger.

func (*HumanReadable) Syslog

func (h *HumanReadable) Syslog(p pri.Priority, msg interface{}) error

Syslog logs a message. In the case of HumanReadable, the message will be given a specific format and then forwarded to another syslogger.Syslogger.

type Multi

type Multi struct {
	Sysloggers []Syslogger
	TryAll     bool
}

Multi is a syslogger.Syslogger that will send messages to all of several other syslogger.Sysloggers.

func (*Multi) Syslog

func (m *Multi) Syslog(p pri.Priority, msg interface{}) error

Syslog logs a message. In the case of Multi, the message will be sent to each of several other syslogger.Sysloggers assuming none of the syslogger.Sysloggers produce an error.

type NativeSyslog

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

NativeSyslog is a syslogger.Syslogger that is a lightweight wrapper around golang's native log/syslog.Writer.

func DialNativeSyslog

func DialNativeSyslog(
	network string,
	raddr string,
	f pri.Priority,
	ident string,
) (*NativeSyslog, error)

DialNativeSyslog creates a new NativeSyslog based on using log/syslog.Dial.

func NewNativeSyslog

func NewNativeSyslog(f pri.Priority, ident string) (*NativeSyslog, error)

NewNativeSyslog creates a new NativeSyslog based on the given log facility and identity string.

func (*NativeSyslog) Close

func (n *NativeSyslog) Close() error

Close closes a native log/syslog.Writer.

func (*NativeSyslog) Syslog

func (n *NativeSyslog) Syslog(p pri.Priority, msg interface{}) error

Syslog logs a message. In the case of NativeSyslog, the message is sent to golang's log/syslog.Writer.

type Newliner

type Newliner struct {
	Syslogger Syslogger
}

Newliner is a syslogger.Syslogger that assures the last byte in a message is a newline (i.e. a literal byte 0x0A).

func (*Newliner) Syslog

func (n *Newliner) Syslog(p pri.Priority, msg interface{}) error

Syslog logs a message. In the case of Newliner, the message has a newline added if not already present before passing through to another Syslogger.

type NoWait

type NoWait struct {
	Syslogger Syslogger
}

NoWait is a syslogger.Syslogger that allows calls to Syslog to return immediately.

func (*NoWait) Syslog

func (n *NoWait) Syslog(p pri.Priority, msg interface{}) error

Syslog logs a message. In the case of NoWait, the message will be sent to another syslogger.Syslogger asynchronously.

type Posixish

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

Posixish is a syslogger.Syslogger that behaves much like the syslog system specified in POSIX.

func (*Posixish) Close

func (px *Posixish) Close() error

Close closes a Posixish, which has basically no effect other than to reset all the file descriptors.

func (*Posixish) Closelog

func (px *Posixish) Closelog() error

Closelog closes a Posixish, which has basically no effect other than to reset all the file descriptors.

func (*Posixish) Openlog

func (px *Posixish) Openlog(
	ident string,
	options opt.Option,
	facility pri.Priority,
) error

Openlog re-initializes the Posixish based on the given opt.Option, overriding any previous values.

func (*Posixish) SetLogMask

func (px *Posixish) SetLogMask(m mask.Mask) error

SetLogMask sets the Posixish's log mask.Mask.

func (*Posixish) Syslog

func (px *Posixish) Syslog(p pri.Priority, msg interface{}) error

Syslog logs a message. How this message is routed depends on what settings were given to Openlog (and potentially a log mask).

type Rfc3164

type Rfc3164 struct {
	Syslogger Syslogger
	Ident     string
	Facility  pri.Priority
	Pid       bool
}

Rfc3164 is a syslogger.Syslogger that will format the message in a way that is intended to be compliant with RFC 3164 before passing the modified message to another syslogger.Syslogger.

func (*Rfc3164) Syslog

func (r *Rfc3164) Syslog(p pri.Priority, msg interface{}) error

Syslog logs a message. In the case of Rfc3164, the message is will be given a specific format and then forwarded to another syslogger.Syslogger.

type SeverityMask

type SeverityMask struct {
	Syslogger Syslogger
	Mask      mask.Mask
}

SeverityMask is a syslogger.Syslogger that only forwards messages that aren't masked to another syslogger.Syslogger.

func (*SeverityMask) Syslog

func (s *SeverityMask) Syslog(p pri.Priority, msg interface{}) error

Syslog logs a message. In the case of SeverityMask, the message is sent to another syslogger.Syslogger if and only if the message isn't masked.

type Syslogger

type Syslogger interface {
	Syslog(p pri.Priority, msg interface{}) error
}

Syslogger allows log messages to be recorded (or forwarded to another Syslogger) in some way.

type Writer

type Writer struct {
	Writer io.Writer
}

Writer is a syslogger.Syslogger that writes messages directly to an io.Writer.

func (*Writer) Syslog

func (w *Writer) Syslog(p pri.Priority, msg interface{}) error

Syslog logs a message. In the case of Writer, the message is written directly to an arbitrary io.Writer.

Jump to

Keyboard shortcuts

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