logger

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 3 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 (*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.

func New

func New(lvl Level, out OutputFunc) Logger

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

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

func NewFromString added in v0.6.2

func NewFromString(s string) Logger

NewFromString creates a logger with s severity parsed from string.

If s is empty or invalid it defaults to WARN.

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