logger

package
v1.9.7 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 0 Imported by: 1,141

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompatibleLogger added in v0.3.4

type CompatibleLogger interface {
	Print(v ...interface{})
	Printf(format string, v ...interface{})
	Println(v ...interface{})
}

CompatibleLogger todo

type Field

type Field struct {
	Key   string
	Value interface{}
}

Field 日志元数据

func NewAny

func NewAny(key string, value interface{}) Field

NewAny 任意类型Field

func NewFieldsFromKV

func NewFieldsFromKV(kvs map[string]interface{}) []Field

NewFieldsFromKV todo

type FormatLogger

type FormatLogger interface {
	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{})
	Panicf(format string, args ...interface{})
}

FormatLogger 携带format的日志打印

type Logger

type Logger interface {
	StandardLogger
	FormatLogger
	WithMetaLogger
	RecoveryLogger
	CompatibleLogger

	// 用于创建子Logger
	Named(name string) Logger
	With(fields ...Field) Logger
}

Logger 程序日志接口, 用于适配多种第三方日志插件

type RecoveryLogger

type RecoveryLogger interface {
	Recover(msg string)
}

RecoveryLogger 记录Panice的日志

type StandardLogger

type StandardLogger interface {
	Debug(msgs ...interface{})
	Info(msgs ...interface{})
	Warn(msgs ...interface{})
	Error(msgs ...interface{})
	Fatal(msgs ...interface{})
	Panic(msgs ...interface{})
}

StandardLogger 标准的日志打印

type WithMetaLogger

type WithMetaLogger interface {
	Debugw(msg string, fields ...Field)
	Infow(msg string, fields ...Field)
	Warnw(msg string, fields ...Field)
	Errorw(msg string, fields ...Field)
	Fatalw(msg string, fields ...Field)
	Panicw(msg string, fields ...Field)
}

WithMetaLogger 携带额外的日志meta数据

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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