log

package
v1.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package log 重新定义了标准日志接口,可以灵活适配各种日志框架。

Index

Constants

View Source
const (
	TraceLevel = Level(0)
	DebugLevel = Level(1)
	InfoLevel  = Level(2)
	WarnLevel  = Level(3)
	ErrorLevel = Level(4)
	PanicLevel = Level(5)
	FatalLevel = Level(6)
)

Variables

This section is empty.

Functions

func Console

func Console(skip int, level Level, e *Entry)

Console 将日志输出到控制台。

func Debug

func Debug(args ...interface{})

Debug 输出 DEBUG 级别的日志。

func Debugf

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

Debugf 输出 DEBUG 级别的日志。

func EnableDebug

func EnableDebug() bool

EnableDebug 是否允许输出 DEBUG 级别的日志。

func EnableError

func EnableError() bool

EnableError 是否允许输出 ERROR 级别的日志。

func EnableFatal

func EnableFatal() bool

EnableFatal 是否允许输出 FATAL 级别的日志。

func EnableInfo

func EnableInfo() bool

EnableInfo 是否允许输出 INFO 级别的日志。

func EnablePanic

func EnablePanic() bool

EnablePanic 是否允许输出 PANIC 级别的日志。

func EnableTrace

func EnableTrace() bool

EnableTrace 是否允许输出 TRACE 级别的日志。

func EnableWarn

func EnableWarn() bool

EnableWarn 是否允许输出 WARN 级别的日志。

func Error

func Error(args ...interface{})

Error 输出 ERROR 级别的日志。

func Errorf

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

Errorf 输出 ERROR 级别的日志。

func Fatal

func Fatal(args ...interface{})

Fatal 输出 FATAL 级别的日志。

func Fatalf

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

Fatalf 输出 FATAL 级别的日志。

func Info

func Info(args ...interface{})

Info 输出 INFO 级别的日志。

func Infof

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

Infof 输出 INFO 级别的日志。

func Panic

func Panic(args ...interface{})

Panic 输出 PANIC 级别的日志。

func Panicf

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

Panicf 输出 PANIC 级别的日志。

func Reset

func Reset()

Reset 重新设置输出级别及输出格式。

func SetLevel

func SetLevel(level Level)

SetLevel 设置日志输出的级别。

func SetOutput

func SetOutput(output Output)

SetOutput 设置日志的输出格式。

func T

func T(a ...interface{}) []interface{}

T 将可变参数转换成切片。

func Trace

func Trace(args ...interface{})

Trace 输出 TRACE 级别的日志。

func Tracef

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

Tracef 输出 TRACE 级别的日志。

func Warn

func Warn(args ...interface{})

Warn 输出 WARN 级别的日志。

func Warnf

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

Warnf 输出 WARN 级别的日志。

Types

type Entry

type Entry struct {
	// contains filtered or unexported fields
}

Entry 打包需要记录的日志信息。

func Ctx

func Ctx(ctx context.Context) Entry

Ctx 创建包含 context.Context 对象的 Entry 。

func Tag

func Tag(tag string) Entry

Tag 创建包含 tag 信息的 Entry 。

func (Entry) Ctx

func (e Entry) Ctx(ctx context.Context) Entry

func (Entry) Debug

func (e Entry) Debug(args ...interface{})

Debug 输出 DEBUG 级别的日志。

func (Entry) Debugf

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

Debugf 输出 DEBUG 级别的日志。

func (Entry) Error

func (e Entry) Error(args ...interface{})

Error 输出 ERROR 级别的日志。

func (Entry) Errorf

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

Errorf 输出 ERROR 级别的日志。

func (Entry) Fatal

func (e Entry) Fatal(args ...interface{})

Fatal 输出 FATAL 级别的日志。

func (Entry) Fatalf

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

Fatalf 输出 FATAL 级别的日志。

func (*Entry) GetCtx

func (e *Entry) GetCtx() context.Context

func (*Entry) GetMsg

func (e *Entry) GetMsg() string

func (*Entry) GetTag

func (e *Entry) GetTag() string

func (Entry) Info

func (e Entry) Info(args ...interface{})

Info 输出 INFO 级别的日志。

func (Entry) Infof

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

Infof 输出 INFO 级别的日志。

func (Entry) Panic

func (e Entry) Panic(args ...interface{})

Panic 输出 PANIC 级别的日志。

func (Entry) Panicf

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

Panicf 输出 PANIC 级别的日志。

func (Entry) Tag

func (e Entry) Tag(tag string) Entry

func (Entry) Trace

func (e Entry) Trace(args ...interface{})

Trace 输出 TRACE 级别的日志。

func (Entry) Tracef

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

Tracef 输出 TRACE 级别的日志。

func (Entry) Warn

func (e Entry) Warn(args ...interface{})

Warn 输出 WARN 级别的日志。

func (Entry) Warnf

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

Warnf 输出 WARN 级别的日志。

type Level

type Level uint32

Level 日志输出级别。

func (Level) String

func (level Level) String() string

type Output

type Output func(skip int, level Level, e *Entry)

Output 定制日志的输出格式,skip 是相对于当前函数的调用深度。

Jump to

Keyboard shortcuts

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