logger

package
v0.0.0-...-3c772d0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SyslogPriorityMap = map[string]syslog.Priority{
	"local0": syslog.LOG_LOCAL0,
	"local1": syslog.LOG_LOCAL1,
	"local2": syslog.LOG_LOCAL2,
	"local3": syslog.LOG_LOCAL3,
	"local4": syslog.LOG_LOCAL4,
	"local5": syslog.LOG_LOCAL5,
	"local6": syslog.LOG_LOCAL6,
	"local7": syslog.LOG_LOCAL7,
}

Functions

func Close

func Close()

func Debug

func Debug(args ...interface{})

func Debugf

func Debugf(format string, args ...interface{})

func DialSyslogBackend

func DialSyslogBackend(network, raddr string, priority syslog.Priority, tag string) (*syslogBackend, error)

func Error

func Error(args ...interface{})

func Errorf

func Errorf(format string, args ...interface{})

func Fall

func Fall()

func Fatal

func Fatal(args ...interface{})

func Fatalf

func Fatalf(format string, args ...interface{})

func Info

func Info(args ...interface{})

func Infof

func Infof(format string, args ...interface{})

func Init

func Init(config LogConfig) error

func LogDepth

func LogDepth(s Severity, depth int, format string, args ...interface{})

func LogToStderr

func LogToStderr()

func NewMultiBackend

func NewMultiBackend(bes ...Backend) (*multiBackend, error)

func NewSyslogBackend

func NewSyslogBackend(priorityStr string, tag string) (*syslogBackend, error)

func Printf

func Printf(format string, args ...interface{})

func Rotate

func Rotate(rotateNum1 int, maxSize1 uint64)

func SetFlushDuration

func SetFlushDuration(t time.Duration)

func SetKeepHours

func SetKeepHours(hours uint)

func SetLogging

func SetLogging(level interface{}, backend Backend)

func SetRotateByHour

func SetRotateByHour(rotateByHour bool)

func SetSeverity

func SetSeverity(level interface{})

func Warning

func Warning(args ...interface{})

func Warningf

func Warningf(format string, args ...interface{})

Types

type Backend

type Backend interface {
	Log(s Severity, msg []byte)
	// contains filtered or unexported methods
}

type FileBackend

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

func NewFileBackend

func NewFileBackend(dir string) (*FileBackend, error)

func (*FileBackend) Fall

func (self *FileBackend) Fall()

func (*FileBackend) Flush

func (self *FileBackend) Flush()

func (*FileBackend) Log

func (self *FileBackend) Log(s Severity, msg []byte)

func (*FileBackend) Rotate

func (self *FileBackend) Rotate(rotateNum1 int, maxSize1 uint64)

func (*FileBackend) SetFlushDuration

func (self *FileBackend) SetFlushDuration(t time.Duration)

func (*FileBackend) SetKeepHours

func (self *FileBackend) SetKeepHours(hours uint)

func (*FileBackend) SetRotateByHour

func (self *FileBackend) SetRotateByHour(rotateByHour bool)

type LogConfig

type LogConfig struct {
	Type              string // syslog/stderr/std/file
	Level             string // DEBUG/INFO/WARNING/ERROR/FATAL
	SyslogPriority    string // local0-7
	SyslogSeverity    string
	FileName          string
	FileRotateCount   int
	FileRotateSize    uint64
	FileFlushDuration time.Duration
	RotateByHour      bool
	KeepHours         uint // make sense when RotateByHour is T
}

type Logger

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

func GetLogger

func GetLogger() *Logger

func NewLogger

func NewLogger(level interface{}, backend Backend) *Logger

func NewLoggerFromConfig

func NewLoggerFromConfig(config LogConfig) (Logger, error)

func (*Logger) Close

func (l *Logger) Close()

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...interface{})

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...interface{})

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...interface{})

func (*Logger) LogDepth

func (l *Logger) LogDepth(s Severity, depth int, format string, args ...interface{})

/////////////////////////////////////////////////////////////// depth version, only a low level api

func (*Logger) LogToStderr

func (l *Logger) LogToStderr()

func (*Logger) PrintfSimple

func (l *Logger) PrintfSimple(format string, args ...interface{})

func (*Logger) SetLogging

func (l *Logger) SetLogging(level interface{}, backend Backend)

func (*Logger) SetSeverity

func (l *Logger) SetSeverity(level interface{})

func (*Logger) Warning

func (l *Logger) Warning(args ...interface{})

func (*Logger) Warningf

func (l *Logger) Warningf(format string, args ...interface{})

type Severity

type Severity int
const (
	FATAL Severity = iota
	ERROR
	WARNING
	INFO
	DEBUG
)

Jump to

Keyboard shortcuts

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