logger

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2019 License: MIT Imports: 2 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level uint8

Level is logging severity.

const (
	LevelOff Level = iota
	LevelError
	LevelWarn
	LevelInfo
	LevelDebug
)

func (Level) String

func (lvl Level) String() string

String returns log level string representation.

type LevelLogger

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

LevelLogger is a logger that supports log levels.

func New

func New(lvl Level, out OutputFunc) *LevelLogger

New creates a new leveled logger instance with the given parameters.

If out is nil it uses the standard logger for output.

func (*LevelLogger) Debugf

func (l *LevelLogger) Debugf(format string, v ...interface{})

func (*LevelLogger) Errorf

func (l *LevelLogger) Errorf(format string, v ...interface{})

func (*LevelLogger) Infof

func (l *LevelLogger) Infof(format string, v ...interface{})

func (*LevelLogger) Warnf

func (l *LevelLogger) Warnf(format string, v ...interface{})

type Logger

type Logger interface {
	Errorf(format string, v ...interface{})
	Warnf(format string, v ...interface{})
	Infof(format string, v ...interface{})
	Debugf(format string, v ...interface{})
}

Logger is common logging interface.

type OutputFunc

type OutputFunc func(lvl Level, s string)

OutputFunc prints logs.

Jump to

Keyboard shortcuts

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