syslog

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorHandler

type ErrorHandler func(message string)

ErrorHandler is a callback to call if an internal error must be notified.

type Logger

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

Logger is the object that controls file logging.

func Create

func Create(options Options) (*Logger, error)

Create creates a new syslog logger.

func (*Logger) Destroy

func (logger *Logger) Destroy()

Destroy shuts down the syslog logger.

func (*Logger) LogDebug

func (logger *Logger) LogDebug(now time.Time, msg string, isJSON bool)

LogDebug sends a debug message to the syslog server.

func (*Logger) LogError

func (logger *Logger) LogError(now time.Time, msg string, isJSON bool)

LogError sends an error message to the syslog server.

func (*Logger) LogInfo

func (logger *Logger) LogInfo(now time.Time, msg string, isJSON bool)

LogInfo sends an information message to the syslog server.

func (*Logger) LogWarning

func (logger *Logger) LogWarning(now time.Time, msg string, isJSON bool)

LogWarning sends a warning message to the syslog server.

type Options

type Options struct {
	// Application name to use. Defaults to the binary name.
	AppName string `json:"appName,omitempty"`

	// Syslog server host name.
	Host string `json:"host,omitempty"`

	// Syslog server port. Defaults to 514, 1468 or 6514 depending on the network protocol used.
	Port uint16 `json:"port,omitempty"`

	// Use TCP instead of UDP.
	UseTcp bool `json:"useTcp,omitempty"`

	// Uses a secure connection. Implies TCP.
	UseTls bool `json:"useTls,omitempty"`

	// Send messages in the new RFC 5424 format instead of the original RFC 3164 specification.
	UseRFC5424 bool `json:"useRFC5424,omitempty"`

	// Set the maximum amount of messages to keep in memory if connection to the server is lost.
	MaxMessageQueueSize uint `json:"queueSize,omitempty"`

	// TLSConfig optionally provides a TLS configuration for use.
	TlsConfig *tls.Config

	// A callback to call if an internal error is encountered.
	ErrorHandler ErrorHandler
}

Options specifies the sys logger settings to use when it is created.

Jump to

Keyboard shortcuts

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