log

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package log implements a minimalistic Logger interface.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultConfig is the default Logger Config.
	DefaultConfig = Config{
		Level:        INFO,
		Prefix:       "",
		Flag:         log.Ldate | log.Ltime,
		DebugHandler: os.Stdout,
		InfoHandler:  os.Stdout,
		WarnHandler:  os.Stdout,
		ErrorHandler: os.Stderr,
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Level        Level
	Prefix       string
	Flag         int
	DebugHandler io.Writer
	InfoHandler  io.Writer
	WarnHandler  io.Writer
	ErrorHandler io.Writer
}

Config used to init Logger.

type Level

type Level int

Level defines Logging level.

const (
	DEBUG Level = iota
	INFO
	WARN
	ERROR
)

Logging Levels.

type Logger

type Logger interface {
	Debug(v ...interface{})
	Info(v ...interface{})
	Warn(v ...interface{})
	Error(v ...interface{})
	Debugf(format string, v ...interface{})
	Infof(format string, v ...interface{})
	Warnf(format string, v ...interface{})
	Errorf(format string, v ...interface{})
	SetLevel(l Level)
	LevelLogger(l Level) *log.Logger
}

Logger is the Logging interface.

func NewLogger

func NewLogger(options ...Option) Logger

NewLogger returns a new Logger.

type Option

type Option = func(*Config) error

Option applies config to Logger Config.

Jump to

Keyboard shortcuts

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