log

package
v0.0.0-...-37e6509 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: MIT Imports: 9 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

Debug log debug info

func Debugf

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

Debugf log debug info

func Debugln

func Debugln(args ...interface{})

Debugln log debug info

func Error

func Error(args ...interface{})

Error log error info

func Errorf

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

Errorf log error info

func Errorln

func Errorln(args ...interface{})

Errorln log error info

func Fatalf

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

Fatalf log error info

func Fatalln

func Fatalln(args ...interface{})

Fatalln log error info

func Info

func Info(args ...interface{})

Info log info

func Infof

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

Infof log info

func Infoln

func Infoln(args ...interface{})

Infoln log info

func Init

func Init(c Config) error

Init init logger

func Warn

func Warn(args ...interface{})

Warn log warning info

func Warnf

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

Warnf log warning info

func Warnln

func Warnln(args ...interface{})

Warnln log warning info

func WithError

func WithError(err error) *logrus.Entry

WithError adds an error as single field (using the key defined in ErrorKey) to the Entry.

func WithFields

func WithFields(vs ...string) *logrus.Entry

WithFields adds a map of fields to the Entry.

Types

type Config

type Config struct {
	Module  string `yaml:"module" json:"module"`
	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)$"`
	Console bool   `yaml:"console" json:"console" default:"false"`
	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=0"`
	} `yaml:"backup" json:"backup"`
}

Config logger config

Jump to

Keyboard shortcuts

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