logger

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2020 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discard

type Discard struct{}

Discard is an logger on which all Write calls succeed without doing anything.

func NewDiscard

func NewDiscard() Discard

NewDiscard a discard logger on which always succeed without doing anything

func (Discard) DPanicf

func (sf Discard) DPanicf(string, ...interface{})

DPanicf implement Logger interface.

func (Discard) Debugf

func (sf Discard) Debugf(string, ...interface{})

Debugf implement Logger interface.

func (Discard) Errorf

func (sf Discard) Errorf(string, ...interface{})

Errorf implement Logger interface.

func (Discard) Fatalf

func (sf Discard) Fatalf(string, ...interface{})

Fatalf implement Logger interface.

func (Discard) Infof

func (sf Discard) Infof(string, ...interface{})

Infof implement Logger interface.

func (Discard) Warnf

func (sf Discard) Warnf(string, ...interface{})

Warnf implement Logger interface.

type Logger

type Logger interface {
	Debugf(format string, arg ...interface{})
	Infof(format string, arg ...interface{})
	Warnf(format string, arg ...interface{})
	Errorf(format string, arg ...interface{})
	DPanicf(format string, arg ...interface{})
	Fatalf(format string, arg ...interface{})
}

Logger log interface

type Option

type Option func(std *Std)

Option option

func WithEnable

func WithEnable(enable bool) Option

WithEnable enable log or not

type Std

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

Std 标准输出, os.Stdout, os.Stderr, os.Stdin, ioutil.Discard

func New

func New(l *log.Logger, opts ...Option) *Std

New new std logger with option

func (Std) DPanicf

func (sf Std) DPanicf(format string, args ...interface{})

DPanicf implement Logger interface.

func (Std) Debugf

func (sf Std) Debugf(format string, args ...interface{})

Debugf implement Logger interface.

func (Std) Errorf

func (sf Std) Errorf(format string, args ...interface{})

Errorf implement Logger interface.

func (Std) Fatalf

func (sf Std) Fatalf(format string, args ...interface{})

Fatalf implement Logger interface.

func (Std) Infof

func (sf Std) Infof(format string, args ...interface{})

Infof implement Logger interface.

func (*Std) Mode

func (sf *Std) Mode(enable bool)

Mode enable log or not

func (Std) Warnf

func (sf Std) Warnf(format string, args ...interface{})

Warnf implement Logger interface.

Jump to

Keyboard shortcuts

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