Documentation
¶
Index ¶
- func Debug(a ...interface{})
- func Debugf(format string, a ...interface{})
- func Error(a ...interface{})
- func Errorf(format string, a ...interface{})
- func Fatal(a ...interface{})
- func Fatalf(format string, a ...interface{})
- func GetFrames(skip int, depth StacktraceDepth) []runtime.Frame
- func GetStacktrace(skip int, depth StacktraceDepth) *stacktrace
- func Info(a ...interface{})
- func Infof(format string, a ...interface{})
- func NewWriter(opts WriterOptions) (io.Writer, error)
- func Panic(a ...interface{})
- func Panicf(format string, a ...interface{})
- func SetLogger(logger Logger)
- func Warn(a ...interface{})
- func Warnf(format string, a ...interface{})
- type CallerFormat
- type CutRule
- type Entity
- type EntityPool
- type Format
- type Level
- type Logger
- type Option
- func WithCallerFormat(format CallerFormat) Option
- func WithCallerSkip(skip int) Option
- func WithEnableLeveledStorage(enable bool) Option
- func WithFileCutRule(cutRule CutRule) Option
- func WithFileMaxAge(maxAge time.Duration) Option
- func WithFileMaxSize(size int64) Option
- func WithOutFile(file string) Option
- func WithOutFormat(format Format) Option
- func WithOutLevel(level Level) Option
- func WithStackLevel(level Level) Option
- func WithTimestampFormat(format string) Option
- type StacktraceDepth
- type Std
- func (l *Std) Debug(a ...interface{})
- func (l *Std) Debugf(format string, a ...interface{})
- func (l *Std) Entity(level Level, a ...interface{}) *Entity
- func (l *Std) Error(a ...interface{})
- func (l *Std) Errorf(format string, a ...interface{})
- func (l *Std) Fatal(a ...interface{})
- func (l *Std) Fatalf(format string, a ...interface{})
- func (l *Std) Info(a ...interface{})
- func (l *Std) Infof(format string, a ...interface{})
- func (l *Std) Panic(a ...interface{})
- func (l *Std) Panicf(format string, a ...interface{})
- func (l *Std) Warn(a ...interface{})
- func (l *Std) Warnf(format string, a ...interface{})
- type WriterOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetStacktrace ¶ added in v0.0.3
func GetStacktrace(skip int, depth StacktraceDepth) *stacktrace
Types ¶
type CallerFormat ¶ added in v0.0.3
type CallerFormat int
调用则格式
const ( CallerShortPath CallerFormat = iota // 调用者短路径 CallerFullPath // 调用者全路径 )
type Entity ¶ added in v0.0.3
type EntityPool ¶ added in v0.0.3
type EntityPool struct {
// contains filtered or unexported fields
}
type Logger ¶
type Logger interface {
// Debug 打印调试日志
Debug(a ...interface{})
// Debugf 打印调试模板日志
Debugf(format string, a ...interface{})
// Info 打印信息日志
Info(a ...interface{})
// Infof 打印信息模板日志
Infof(format string, a ...interface{})
// Warn 打印警告日志
Warn(a ...interface{})
// Warnf 打印警告模板日志
Warnf(format string, a ...interface{})
// Error 打印错误日志
Error(a ...interface{})
// Errorf 打印错误模板日志
Errorf(format string, a ...interface{})
// Fatal 打印致命错误日志
Fatal(a ...interface{})
// Fatalf 打印致命错误模板日志
Fatalf(format string, a ...interface{})
// Panic 打印Panic日志
Panic(a ...interface{})
// Panicf 打印Panic模板日志
Panicf(format string, a ...interface{})
}
type Option ¶
type Option func(o *options)
func WithCallerFormat ¶ added in v0.0.3
func WithCallerFormat(format CallerFormat) Option
WithCallerFormat 设置调用者格式
func WithCallerSkip ¶ added in v0.0.3
WithCallerSkip 设置调用者跳过的层级深度
func WithEnableLeveledStorage ¶ added in v0.0.3
WithEnableLeveledStorage 设置启用文件分级存储 启用后,日志将进行分级存储,大一级的日志将存储于小于等于自身的日志级别文件中 例如:InfoLevel级的日志将存储于due.debug.20220910.log、due.info.20220910.log两个日志文件中
func WithFileCutRule ¶ added in v0.0.3
WithFileCutRule 设置文件切割规则
func WithFileMaxAge ¶ added in v0.0.3
WithFileMaxAge 设置文件最大留存时间
func WithFileMaxSize ¶ added in v0.0.3
WithFileMaxSize 设置输出的单个文件尺寸限制
func WithOutFormat ¶ added in v0.0.3
WithOutFormat 设置输出的日志格式
func WithStackLevel ¶ added in v0.0.3
WithStackLevel 设置堆栈的最小输出级别
func WithTimestampFormat ¶ added in v0.0.3
WithTimestampFormat 设置时间格式
type StacktraceDepth ¶ added in v0.0.3
type StacktraceDepth int
const ( // stacktraceFirst captures only the first frame. StacktraceFirst StacktraceDepth = iota // stacktraceFull captures the entire call stack, allocating more // storage for it if needed. StacktraceFull )
type Std ¶ added in v0.0.3
type Std struct {
// contains filtered or unexported fields
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.