logger

package
v0.0.0-...-32dd021 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2022 License: LGPL-2.1 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TraceLogger *zap.Logger
)

Functions

func MessageDroped

func MessageDroped() int64

查看因处理不过来而丢弃了多少条日志

func MessageRemaining

func MessageRemaining() int

查看所有队列中的消息总数

func NewOption

func NewOption(opts ...FileOptionHandle) *fileWriterOption

func NewTracingLog

func NewTracingLog(logDir string) error

func SetGlobalLevel

func SetGlobalLevel(lv int, d time.Duration)

func SetWarnFunc

func SetWarnFunc(f func(string))

设置警告信息处理方法

func TailLog

func TailLog(fileName string) chan string

没一个要读取的file可能由多个ws连接, 要复用则包装tails,并加上一系列channel

Types

type FileOptionHandle

type FileOptionHandle func(*fileWriterOption)

func WithAsync

func WithAsync(b bool) FileOptionHandle

func WithClone

func WithClone(c io.Writer) FileOptionHandle

func WithCompress

func WithCompress(count, keep int) FileOptionHandle

func WithLabel

func WithLabel(l string) FileOptionHandle

func WithName

func WithName(n string) FileOptionHandle

func WithPath

func WithPath(p string) FileOptionHandle

func WithWarnDropNumber

func WithWarnDropNumber(w1, w2, dn int) FileOptionHandle

type FileWriter

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

FileWriter ...

func NewFileWriter

func NewFileWriter(option *fileWriterOption) *FileWriter

NewFileWriter ...

func (*FileWriter) Write

func (o *FileWriter) Write(p []byte) (n int, err error)

type Handler

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

func NewAsyncHandler

func NewAsyncHandler(path, label string, clone io.Writer, count, keep int, defaultlevel ...int) *Handler

NewAsyncHandler 异步io的日志句柄

func NewHandler

func NewHandler(path, label string, clone io.Writer, count, keep int, defaultlevel ...int) *Handler

NewHandler 同步io的日志句柄

func (*Handler) Debug

func (o *Handler) Debug(file ...string) *zerolog.Event

func (*Handler) Err

func (o *Handler) Err(err error, file ...string) *zerolog.Event

func (*Handler) Error

func (o *Handler) Error(file ...string) *zerolog.Event

func (*Handler) File

func (o *Handler) File(file ...string) *zlog

func (*Handler) GetLevel

func (o *Handler) GetLevel() (res []LogLevel)

func (*Handler) Info

func (o *Handler) Info(file ...string) *zerolog.Event

func (*Handler) Log

func (o *Handler) Log(file ...string) *zerolog.Event

func (*Handler) Panic

func (o *Handler) Panic(file ...string) *zerolog.Event

func (*Handler) RouteWithLogTo

func (o *Handler) RouteWithLogTo(file string, do func(w http.ResponseWriter, r *http.Request, et *zerolog.Event), aggCost ...bool) http.HandlerFunc

RouteWithLogTo 路由包装,日志输出到指定文件中

func (*Handler) SetDefaultLevel

func (o *Handler) SetDefaultLevel(lv int)

修改某一业务日志的默认级别,所有操作对象的级别变更到不低于新的默认级别

func (*Handler) SetLevel

func (o *Handler) SetLevel(lv int, d ...time.Duration)

修改某一业务日志的级别,低于默认级别时要设置发送切回请求

func (*Handler) Trace

func (o *Handler) Trace(file ...string) *zerolog.Event

func (*Handler) Warn

func (o *Handler) Warn(file ...string) *zerolog.Event

func (*Handler) WithLevel

func (o *Handler) WithLevel(level zerolog.Level, file ...string) *zerolog.Event

type LogLevel

type LogLevel struct {
	Path  string
	Label string
	Name  string
	Level int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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