logger

package
v0.0.0-...-53e3d08 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

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

Debugf to global logger

func Debugln

func Debugln(args ...interface{})

Debugln to global logger

func Errorf

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

Errorf to global logger

func Errorln

func Errorln(args ...interface{})

Errorln to global logger

func Fatalf

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

Fatalf to global logger

func Fatalln

func Fatalln(args ...interface{})

Fatalln to global logger

func Infof

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

Infof to global logger

func Infoln

func Infoln(args ...interface{})

Infoln to global logger

func Warnf

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

Warnf to global logger

func Warnln

func Warnln(args ...interface{})

Warnln to global logger

Types

type LogInfo

type LogInfo struct {
	Path   string `yaml:"path" json:"path"`
	Level  string `yaml:"level" json:"level" default:"info" validate:"regexp=^(info|debug|warn|error)$"`
	Format string `yaml:"format" json:"format" default:"text" validate:"regexp=^(text|json)$"`
	Age    struct {
		Max int `yaml:"max" json:"max" default:"15" validate:"min=1"`
	} `yaml:"age" json:"age"` // days
	Size struct {
		Max int `yaml:"max" json:"max" default:"50" validate:"min=1"`
	} `yaml:"size" json:"size"` // in MB
	Backup struct {
		Max int `yaml:"max" json:"max" default:"15" validate:"min=1"`
	} `yaml:"backup" json:"backup"`
}

LogInfo for logging

type Logger

type Logger interface {
	WithField(key string, value interface{}) Logger
	WithError(err error) Logger
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Debugln(args ...interface{})
	Infoln(args ...interface{})
	Warnln(args ...interface{})
	Errorln(args ...interface{})
	Fatalln(args ...interface{})
}

Logger of module

var Global Logger

Global the global logger

func InitLogger

func InitLogger(c LogInfo, fields ...string) Logger

InitLogger init global logger

func WithError

func WithError(err error) Logger

WithError to global logger

func WithField

func WithField(key string, value interface{}) Logger

WithField to global logger

Jump to

Keyboard shortcuts

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