Documentation
¶
Index ¶
- Constants
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func GetTraceCtx(ctx context.Context, args ...string) context.Context
- func GetTraceId(ctx context.Context) string
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Trace(args ...interface{})
- func Tracef(format string, args ...interface{})
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Writer() io.Writer
- type Config
- type CtxTraceKey
- type Fields
- type Formatter
- type Level
- type Logger
- type Option
- type Type
Constants ¶
View Source
const (
FieldTraceId = "trace_id"
)
...
Variables ¶
This section is empty.
Functions ¶
func GetTraceCtx ¶
GetTraceCtx ...
Types ¶
type Config ¶
type Config struct { Type Type `yaml:"type"` // 日志类型 Level Level `yaml:"level"` // 日志级别 Formatter Formatter `yaml:"formatter"` // 输出格式 Filepath string `yaml:"filepath"` // 文件路径 Stdout bool `yaml:"stdout"` // 输出终端 }
Config ...
type Logger ¶
type Logger interface { Log(level Level, args ...interface{}) // 记录对应级别的日志 Logf(level Level, format string, args ...interface{}) // 记录对应级别的日志 Trace(args ...interface{}) // 记录 TraceLevel 级别的日志 Tracef(format string, args ...interface{}) // 格式化并记录 TraceLevel 级别的日志 Debug(args ...interface{}) // 记录 DebugLevel 级别的日志 Debugf(format string, args ...interface{}) // 格式化并记录 DebugLevel 级别的日志 Info(args ...interface{}) // 记录 InfoLevel 级别的日志 Infof(format string, args ...interface{}) // 格式化并记录 InfoLevel 级别的日志 Warn(args ...interface{}) // 记录 WarnLevel 级别的日志 Warnf(format string, args ...interface{}) // 格式化并记录 WarnLevel 级别的日志 Error(args ...interface{}) // 记录 ErrorLevel 级别的日志 Errorf(format string, args ...interface{}) // 格式化并记录 ErrorLevel 级别的日志 //Fatal(args ...interface{}) // 记录 FatalLevel 级别的日志 //Fatalf(format string, args ...interface{}) // 格式化并记录 FatalLevel 级别的日志 //Panic(args ...interface{}) // 记录 PanicLevel 级别的日志 //Panicf(format string, args ...interface{}) // 格式化并记录 PanicLevel 级别的日志 Writer() io.Writer // 返回日志 io.Writer Field(key string, value interface{}) Logger // WithField 为日志添加一个上下文数据 Ctx(ctx context.Context) Logger // WithContext 为日志添加一个 context }
Logger ...
Click to show internal directories.
Click to hide internal directories.