logger

package module
Version: v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: Apache-2.0 Imports: 9 Imported by: 14

README

logger

如何使用

導入
 go get github.com/codingXiang/go-logger/v2
使用

創建實例

logger.Log = logger.NewLogger(logger.Logger{
	Level: "debug",
	Format: "json",
})
//Debug
logger.Log.Debug("test")

Documentation

Index

Constants

View Source
const (
	LOG      = "log"
	LEVEL    = "level"
	MAX_AGE  = "maxAge"
	FORMAT   = "format"
	FILENAME = "filename"
	PATH     = "path"
)

Variables

This section is empty.

Functions

func GetConfigPath

func GetConfigPath(key string, path ...string) string

func GetPathSymbol

func GetPathSymbol() string

Types

type Format

type Format int
const (
	Text Format = iota
	Json
)

func NewFormat

func NewFormat(f string) Format

func (Format) Get

func (f Format) Get() logrus.Formatter

type Level

type Level int
const (
	Debug Level = iota
	Info
	Warn
	Error
	Fatal
	Panic
)

func NewLevel

func NewLevel(l string) Level

func (Level) Get

func (level Level) Get() logrus.Level

func (Level) String

func (l Level) String() string

type Logger

type Logger struct {
	*logrus.Logger
	// contains filtered or unexported fields
}
var Log *Logger

func Default

func Default() *Logger

func New

func New(config *viper.Viper) *Logger

func (*Logger) Output

func (l *Logger) Output(config *viper.Viper)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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