log

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ModuleSystem = "System"

Variables

View Source
var (
	Error    = log.Error
	Errorf   = log.Errorf
	Info     = log.Info
	Infof    = log.Infof
	Warning  = log.Warning
	Warningf = log.Warningf
	Fatal    = log.Fatal
	Fatalf   = log.Fatalf
	Debug    = log.Debug
	Debugf   = log.Debugf

	IsDebug = log.IsEnabledFor(logging.DEBUG)
)

Functions

func SetupLog

func SetupLog(level logging.Level, syslogaddr string, logdir string, module string)

Types

type SyslogBackend

type SyslogBackend struct {
	Writer *syslog.Writer
}

SyslogBackend is a simple logger to syslog backend. It automatically maps the internal log levels to appropriate syslog log levels.

func NewSyslogBackend

func NewSyslogBackend(prefix string, syslogaddr string, priority syslog.Priority) (b *SyslogBackend, err error)

NewSyslogBackend connects to the syslog daemon using UNIX sockets with the given prefix. If prefix is not given, the prefix will be derived from the launched command.

func NewSyslogBackendPriority

func NewSyslogBackendPriority(prefix string, priority syslog.Priority) (b *SyslogBackend, err error)

NewSyslogBackendPriority is the same as NewSyslogBackend, but with custom syslog priority, like syslog.LOG_LOCAL3|syslog.LOG_DEBUG etc.

func (*SyslogBackend) Log

func (b *SyslogBackend) Log(level logging.Level, calldepth int, rec *logging.Record) error

Log implements the Backend interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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