logger

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEBUG int = iota
	INFO
	WARNING
	ERROR
)

Default four levels for logging.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	*log.Logger
	// contains filtered or unexported fields
}

func New

func New(dest string, logLevel int) (*Logger, error)

New creates a new Logger instance, which writes to the specified destination (file) or stdout if dest is empty. It also sets the log level.

func (*Logger) Debug

func (l *Logger) Debug(ctx context.Context, v ...interface{}) error

func (*Logger) Debugf

func (l *Logger) Debugf(ctx context.Context, format string, v ...interface{}) error

Debugf logs a formatted debug message.

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, v ...interface{}) error

func (*Logger) Errorf

func (l *Logger) Errorf(ctx context.Context, format string, v ...interface{}) error

Errorf logs a formatted error message.

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, v ...interface{}) error

func (*Logger) Infof

func (l *Logger) Infof(ctx context.Context, format string, v ...interface{}) error

Infof logs a formatted info message.

func (*Logger) Output

func (l *Logger) Output(calldepth int, s string) error

Custom log output function. It is used to add additional runtime information to the log message.

func (*Logger) Warning

func (l *Logger) Warning(ctx context.Context, v ...interface{}) error

func (*Logger) Warningf

func (l *Logger) Warningf(ctx context.Context, format string, v ...interface{}) error

Warningf logs a formatted warning message.

Jump to

Keyboard shortcuts

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