logging

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrParseStrToLevel indicates that string given to function ParseLevel can't be parsed to Level.
	ErrParseStrToLevel = errors.New("string can't be parsed to level, use: `error`, `info`, `warning`, `debug`")
)

Functions

This section is empty.

Types

type DisabledLog

type DisabledLog struct{}

func (*DisabledLog) Debug

func (l *DisabledLog) Debug(string, ...interface{})

func (*DisabledLog) Error

func (l *DisabledLog) Error(string, ...interface{})

func (*DisabledLog) Info

func (l *DisabledLog) Info(string, ...interface{})

type Level

type Level int

Level represents enumeration of logging levels.

const (
	// ERR represents error logging level.
	ERR Level = iota
	// INF represents info logging level.
	INF
	// DBG represents debug logging level.
	DBG
	// DSB empty log.
	DSB
)

func ParseLevel

func ParseLevel(lvl string) (Level, error)

func (Level) String

func (l Level) String() string

type Logger

type Logger interface {
	// Debug prints message with debug level.
	Debug(format string, v ...interface{})
	// Info prints message with info level.
	Info(format string, v ...interface{})
	// Error prints message with error level.
	Error(format string, v ...interface{})
}

Logger represents logging logic.

func NewDisabledLog

func NewDisabledLog() Logger

func NewStdLog

func NewStdLog(level Level) Logger

NewStdLog returns a new instance of StdLog struct. Takes variadic options which will be applied to StdLog.

type StdLog

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

StdLog represents standard library logger with levels.

func (*StdLog) Debug

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

func (*StdLog) Error

func (l *StdLog) Error(format string, v ...interface{})

func (*StdLog) Info

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

Jump to

Keyboard shortcuts

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