log

package
v3.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2016 License: Apache-2.0 Imports: 12 Imported by: 6,111

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Close

func Close()

func Critical

func Critical(skip int, format string, v ...interface{})

func Debug

func Debug(format string, v ...interface{})

func Debug2

func Debug2(message string, v ...interface{})

func Error

func Error(skip int, format string, v ...interface{})

func Error2

func Error2(message string, v ...interface{})

func Fatal

func Fatal(skip int, format string, v ...interface{})

func Info

func Info(format string, v ...interface{})

func Info2

func Info2(message string, v ...interface{})

func LogFilterHandler

func LogFilterHandler(maxLevel log15.Lvl, filters map[string]log15.Lvl, h log15.Handler) log15.Handler

func ReadLoggingConfig

func ReadLoggingConfig(modes []string, logsPath string, cfg *ini.File)

func Trace

func Trace(format string, v ...interface{})

func Warn

func Warn(format string, v ...interface{})

func Warn2

func Warn2(message string, v ...interface{})

Types

type DisposableHandler

type DisposableHandler interface {
	Close()
}

type FileLogWriter

type FileLogWriter struct {
	Format   log15.Format
	Filename string
	Maxlines int

	// Rotate at size
	Maxsize int

	// Rotate daily
	Daily   bool
	Maxdays int64

	Rotate bool
	// contains filtered or unexported fields
}

FileLogWriter implements LoggerInterface. It writes messages by lines limit, file size limit, or time frequency.

func NewFileWriter

func NewFileWriter() *FileLogWriter

create a FileLogWriter returning as LoggerInterface.

func (*FileLogWriter) Close

func (w *FileLogWriter) Close()

destroy file logger, close file writer.

func (*FileLogWriter) DoRotate

func (w *FileLogWriter) DoRotate() error

DoRotate means it need to write file in new file. new file name like xx.log.2013-01-01.2

func (*FileLogWriter) Flush

func (w *FileLogWriter) Flush()

flush file logger. there are no buffering messages in file logger in memory. flush file means sync file from disk.

func (*FileLogWriter) Init

func (w *FileLogWriter) Init() error

func (*FileLogWriter) Log

func (w *FileLogWriter) Log(r *log15.Record) error

func (*FileLogWriter) StartLogger

func (w *FileLogWriter) StartLogger() error

start file logger. create log file and set to locker-inside file writer.

type Logger

type Logger interface {
	// New returns a new Logger that has this logger's context plus the given context
	New(ctx ...interface{}) log15.Logger

	// GetHandler gets the handler associated with the logger.
	GetHandler() log15.Handler

	// SetHandler updates the logger to write records to the specified handler.
	SetHandler(h log15.Handler)

	// Log a message at the given level with context key/value pairs
	Debug(msg string, ctx ...interface{})
	Info(msg string, ctx ...interface{})
	Warn(msg string, ctx ...interface{})
	Error(msg string, ctx ...interface{})
	Crit(msg string, ctx ...interface{})
}

func New

func New(logger string, ctx ...interface{}) Logger

type Lvl

type Lvl int
const (
	LvlCrit Lvl = iota
	LvlError
	LvlWarn
	LvlInfo
	LvlDebug
)

type MuxWriter

type MuxWriter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

an *os.File writer with locker.

func (*MuxWriter) SetFd

func (l *MuxWriter) SetFd(fd *os.File)

set os.File in writer.

func (*MuxWriter) Write

func (l *MuxWriter) Write(b []byte) (int, error)

write to os.File.

type SysLogHandler

type SysLogHandler struct {
	Network  string
	Address  string
	Facility string
	Tag      string
	Format   log15.Format
	// contains filtered or unexported fields
}

func NewSyslog

func NewSyslog(sec *ini.Section, format log15.Format) *SysLogHandler

func (*SysLogHandler) Close

func (sw *SysLogHandler) Close()

func (*SysLogHandler) Init

func (sw *SysLogHandler) Init() error

func (*SysLogHandler) Log

func (sw *SysLogHandler) Log(r *log15.Record) error

Jump to

Keyboard shortcuts

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