logger

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package logger 提供日志记录功能 每条日志均会输出 app、module 字段,分别代表应用,模块,默认值为 default,此两个字段会合并为 fluentd 的 tag 设备插件 app 请使用 plugin_{插件名称} 的格式,方便后台查看 debug 模式下会输出 caller、package 字段作为跟踪

Index

Constants

View Source
const (
	NewEntrySkip    = 4 // 外部通过new新的logger,获取的caller层级
	DirectEntrySkip = 5 // 直接调用封装的方法,获取的caller层级
)

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

func Debugf

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

func Error

func Error(args ...interface{})

func Errorf

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

func Info

func Info(args ...interface{})

func Infof

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

func InitLogger

func InitLogger(output io.Writer, level logrus.Level, f logrus.Fields, debug bool, hooks ...logrus.Hook)

InitLogger generate a global instance

func New

func New() *logrus.Logger

New 外部使用

func Panic

func Panic(args ...interface{})

func Panicf

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

func Panicln

func Panicln(args ...interface{})

func Printf

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

func Println

func Println(args ...interface{})

func SetDebug

func SetDebug(IsDebug bool)

func Warn

func Warn(args ...interface{})

func Warnf

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

func Warning

func Warning(args ...interface{})

func Warningf

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

Types

type Entry

type Entry struct {
	Entry *logrus.Entry
	Skip  int // caller层级
}

func NewEntry

func NewEntry() *Entry

NewEntry 外部初始化

func (*Entry) Debug

func (entry *Entry) Debug(args ...interface{})

func (*Entry) Debugf

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

func (*Entry) Debugln

func (entry *Entry) Debugln(args ...interface{})

func (*Entry) Error

func (entry *Entry) Error(args ...interface{})

func (*Entry) Errorf

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

func (*Entry) Errorln

func (entry *Entry) Errorln(args ...interface{})

func (*Entry) Fatal

func (entry *Entry) Fatal(args ...interface{})

func (*Entry) Fatalf

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

func (*Entry) Fatalln

func (entry *Entry) Fatalln(args ...interface{})

func (*Entry) Info

func (entry *Entry) Info(args ...interface{})

func (*Entry) Infof

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

func (*Entry) Infoln

func (entry *Entry) Infoln(args ...interface{})

func (*Entry) Log

func (entry *Entry) Log(level logrus.Level, args ...interface{})

func (*Entry) Logf

func (entry *Entry) Logf(level logrus.Level, format string, args ...interface{})

func (*Entry) Logln

func (entry *Entry) Logln(level logrus.Level, args ...interface{})

func (*Entry) Panic

func (entry *Entry) Panic(args ...interface{})

func (*Entry) Panicf

func (entry *Entry) Panicf(format string, args ...interface{})

func (*Entry) Panicln

func (entry *Entry) Panicln(args ...interface{})

func (*Entry) Print

func (entry *Entry) Print(args ...interface{})

func (*Entry) Printf

func (entry *Entry) Printf(format string, args ...interface{})

func (*Entry) Println

func (entry *Entry) Println(args ...interface{})

func (*Entry) Trace

func (entry *Entry) Trace(args ...interface{})

func (*Entry) Tracef

func (entry *Entry) Tracef(format string, args ...interface{})

func (*Entry) Traceln

func (entry *Entry) Traceln(args ...interface{})

func (*Entry) Warn

func (entry *Entry) Warn(args ...interface{})

func (*Entry) Warnf

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

func (*Entry) Warning

func (entry *Entry) Warning(args ...interface{})

func (*Entry) Warningf

func (entry *Entry) Warningf(format string, args ...interface{})

func (*Entry) Warningln

func (entry *Entry) Warningln(args ...interface{})

func (*Entry) Warnln

func (entry *Entry) Warnln(args ...interface{})

func (*Entry) WithField

func (entry *Entry) WithField(key string, value interface{}) *Entry

func (*Entry) WithFields

func (entry *Entry) WithFields(field logrus.Fields) *Entry

type Option

type Option struct {
	Level     logrus.Level
	Output    io.Writer
	LogFormat logrus.Formatter
	Debug     bool
}

Jump to

Keyboard shortcuts

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