Documentation
¶
Index ¶
- Variables
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func LevelToString(l Level) string
- func Output(skip int, level Level, args ...interface{})
- func Outputf(skip int, level Level, format string, args ...interface{})
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func SetLevel(level Level)
- func SetLogger(logger StdLogger)
- func Trace(args ...interface{})
- func Tracef(format string, args ...interface{})
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type Console
- func (c *Console) Debug(args ...interface{})
- func (c *Console) Debugf(format string, args ...interface{})
- func (c *Console) Error(args ...interface{})
- func (c *Console) Errorf(format string, args ...interface{})
- func (c *Console) Fatal(args ...interface{})
- func (c *Console) Fatalf(format string, args ...interface{})
- func (c *Console) Info(args ...interface{})
- func (c *Console) Infof(format string, args ...interface{})
- func (c *Console) Output(skip int, level Level, args ...interface{})
- func (c *Console) Outputf(skip int, level Level, format string, args ...interface{})
- func (c *Console) Panic(args ...interface{})
- func (c *Console) Panicf(format string, args ...interface{})
- func (c *Console) Print(args ...interface{})
- func (c *Console) Printf(format string, args ...interface{})
- func (c *Console) SetLevel(level Level)
- func (c *Console) Trace(args ...interface{})
- func (c *Console) Tracef(format string, args ...interface{})
- func (c *Console) Warn(args ...interface{})
- func (c *Console) Warnf(format string, args ...interface{})
- type DefaultLoggerContext
- func (c *DefaultLoggerContext) Context() context.Context
- func (c *DefaultLoggerContext) LogDebug(args ...interface{})
- func (c *DefaultLoggerContext) LogDebugf(format string, args ...interface{})
- func (c *DefaultLoggerContext) LogError(args ...interface{})
- func (c *DefaultLoggerContext) LogErrorf(format string, args ...interface{})
- func (c *DefaultLoggerContext) LogFatal(args ...interface{})
- func (c *DefaultLoggerContext) LogFatalf(format string, args ...interface{})
- func (c *DefaultLoggerContext) LogInfo(args ...interface{})
- func (c *DefaultLoggerContext) LogInfof(format string, args ...interface{})
- func (c *DefaultLoggerContext) LogPanic(args ...interface{})
- func (c *DefaultLoggerContext) LogPanicf(format string, args ...interface{})
- func (c *DefaultLoggerContext) LogTrace(args ...interface{})
- func (c *DefaultLoggerContext) LogTracef(format string, args ...interface{})
- func (c *DefaultLoggerContext) LogWarn(args ...interface{})
- func (c *DefaultLoggerContext) LogWarnf(format string, args ...interface{})
- func (c *DefaultLoggerContext) Logger(tags ...string) StdLogger
- type Level
- type LoggerContext
- type PrefixLogger
- type StdLogger
- type StdLoggerWrapper
- func (w *StdLoggerWrapper) Debug(args ...interface{})
- func (w *StdLoggerWrapper) Debugf(format string, args ...interface{})
- func (w *StdLoggerWrapper) Error(args ...interface{})
- func (w *StdLoggerWrapper) Errorf(format string, args ...interface{})
- func (w *StdLoggerWrapper) Fatal(args ...interface{})
- func (w *StdLoggerWrapper) Fatalf(format string, args ...interface{})
- func (w *StdLoggerWrapper) Info(args ...interface{})
- func (w *StdLoggerWrapper) Infof(format string, args ...interface{})
- func (w *StdLoggerWrapper) Output(skip int, level Level, args ...interface{})
- func (w *StdLoggerWrapper) Outputf(skip int, level Level, format string, args ...interface{})
- func (w *StdLoggerWrapper) Panic(args ...interface{})
- func (w *StdLoggerWrapper) Panicf(format string, args ...interface{})
- func (w *StdLoggerWrapper) Print(args ...interface{})
- func (w *StdLoggerWrapper) Printf(format string, args ...interface{})
- func (w *StdLoggerWrapper) SetLevel(level Level)
- func (w *StdLoggerWrapper) Trace(args ...interface{})
- func (w *StdLoggerWrapper) Tracef(format string, args ...interface{})
- func (w *StdLoggerWrapper) Warn(args ...interface{})
- func (w *StdLoggerWrapper) Warnf(format string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger func(ctx context.Context, tags ...string) StdLogger
Logger 获取一个标准的 Logger 接口
Functions ¶
Types ¶
type Console ¶
type Console struct {
// contains filtered or unexported fields
}
Console 将日志打印到控制台
type DefaultLoggerContext ¶
type DefaultLoggerContext struct {
// contains filtered or unexported fields
}
DefaultLoggerContext 默认的 LoggerContext 版本
func NewDefaultLoggerContext ¶
func NewDefaultLoggerContext(ctx context.Context) *DefaultLoggerContext
NewDefaultLoggerContext DefaultLoggerContext 的构造函数
func (*DefaultLoggerContext) Context ¶
func (c *DefaultLoggerContext) Context() context.Context
Context 获取标准 Context 对象
func (*DefaultLoggerContext) LogDebug ¶
func (c *DefaultLoggerContext) LogDebug(args ...interface{})
func (*DefaultLoggerContext) LogDebugf ¶
func (c *DefaultLoggerContext) LogDebugf(format string, args ...interface{})
func (*DefaultLoggerContext) LogError ¶
func (c *DefaultLoggerContext) LogError(args ...interface{})
func (*DefaultLoggerContext) LogErrorf ¶
func (c *DefaultLoggerContext) LogErrorf(format string, args ...interface{})
func (*DefaultLoggerContext) LogFatal ¶
func (c *DefaultLoggerContext) LogFatal(args ...interface{})
func (*DefaultLoggerContext) LogFatalf ¶
func (c *DefaultLoggerContext) LogFatalf(format string, args ...interface{})
func (*DefaultLoggerContext) LogInfo ¶
func (c *DefaultLoggerContext) LogInfo(args ...interface{})
func (*DefaultLoggerContext) LogInfof ¶
func (c *DefaultLoggerContext) LogInfof(format string, args ...interface{})
func (*DefaultLoggerContext) LogPanic ¶
func (c *DefaultLoggerContext) LogPanic(args ...interface{})
func (*DefaultLoggerContext) LogPanicf ¶
func (c *DefaultLoggerContext) LogPanicf(format string, args ...interface{})
func (*DefaultLoggerContext) LogTrace ¶
func (c *DefaultLoggerContext) LogTrace(args ...interface{})
func (*DefaultLoggerContext) LogTracef ¶
func (c *DefaultLoggerContext) LogTracef(format string, args ...interface{})
func (*DefaultLoggerContext) LogWarn ¶
func (c *DefaultLoggerContext) LogWarn(args ...interface{})
func (*DefaultLoggerContext) LogWarnf ¶
func (c *DefaultLoggerContext) LogWarnf(format string, args ...interface{})
func (*DefaultLoggerContext) Logger ¶
func (c *DefaultLoggerContext) Logger(tags ...string) StdLogger
Logger 获取标准 Logger 接口
type LoggerContext ¶
type LoggerContext interface { // PrefixLogger 带有前缀的 Logger 接口 PrefixLogger // Context 获取标准 Context 对象 Context() context.Context // Logger 获取标准 Logger 接口 Logger(tags ...string) StdLogger }
LoggerContext 带有 Logger 功能的 context.Context 接口
type PrefixLogger ¶
type PrefixLogger interface { LogTrace(args ...interface{}) LogTracef(format string, args ...interface{}) LogDebug(args ...interface{}) LogDebugf(format string, args ...interface{}) LogInfo(args ...interface{}) LogInfof(format string, args ...interface{}) LogWarn(args ...interface{}) LogWarnf(format string, args ...interface{}) LogError(args ...interface{}) LogErrorf(format string, args ...interface{}) LogPanic(args ...interface{}) LogPanicf(format string, args ...interface{}) LogFatal(args ...interface{}) LogFatalf(format string, args ...interface{}) }
PrefixLogger 带前缀名的 Logger 接口
type StdLogger ¶
type StdLogger interface { // SetLevel 设置日志的输出级别,请确保线程安全 SetLevel(level Level) Trace(args ...interface{}) Tracef(format string, args ...interface{}) Debug(args ...interface{}) Debugf(format string, args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Panic(args ...interface{}) Panicf(format string, args ...interface{}) Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) Print(args ...interface{}) Printf(format string, args ...interface{}) // skip 是相对于 Output & Outputf 的调用栈深度 Output(skip int, level Level, args ...interface{}) Outputf(skip int, level Level, format string, args ...interface{}) }
StdLogger 标准的 Logger 接口
type StdLoggerWrapper ¶
type StdLoggerWrapper struct {
StdLogger
}
为了平衡调用栈的深度,增加一个 StdLogger 包装类
func (*StdLoggerWrapper) Debug ¶
func (w *StdLoggerWrapper) Debug(args ...interface{})
func (*StdLoggerWrapper) Debugf ¶
func (w *StdLoggerWrapper) Debugf(format string, args ...interface{})
func (*StdLoggerWrapper) Error ¶
func (w *StdLoggerWrapper) Error(args ...interface{})
func (*StdLoggerWrapper) Errorf ¶
func (w *StdLoggerWrapper) Errorf(format string, args ...interface{})
func (*StdLoggerWrapper) Fatal ¶
func (w *StdLoggerWrapper) Fatal(args ...interface{})
func (*StdLoggerWrapper) Fatalf ¶
func (w *StdLoggerWrapper) Fatalf(format string, args ...interface{})
func (*StdLoggerWrapper) Info ¶
func (w *StdLoggerWrapper) Info(args ...interface{})
func (*StdLoggerWrapper) Infof ¶
func (w *StdLoggerWrapper) Infof(format string, args ...interface{})
func (*StdLoggerWrapper) Output ¶
func (w *StdLoggerWrapper) Output(skip int, level Level, args ...interface{})
Output 自定义日志级别和调用栈深度,skip 是相对于 Output 的调用栈深度
func (*StdLoggerWrapper) Outputf ¶
func (w *StdLoggerWrapper) Outputf(skip int, level Level, format string, args ...interface{})
Outputf 自定义日志级别和调用栈深度,skip 是相对于 Outputf 的调用栈深度
func (*StdLoggerWrapper) Panic ¶
func (w *StdLoggerWrapper) Panic(args ...interface{})
func (*StdLoggerWrapper) Panicf ¶
func (w *StdLoggerWrapper) Panicf(format string, args ...interface{})
func (*StdLoggerWrapper) Print ¶
func (w *StdLoggerWrapper) Print(args ...interface{})
func (*StdLoggerWrapper) Printf ¶
func (w *StdLoggerWrapper) Printf(format string, args ...interface{})
func (*StdLoggerWrapper) SetLevel ¶
func (w *StdLoggerWrapper) SetLevel(level Level)
func (*StdLoggerWrapper) Trace ¶
func (w *StdLoggerWrapper) Trace(args ...interface{})
func (*StdLoggerWrapper) Tracef ¶
func (w *StdLoggerWrapper) Tracef(format string, args ...interface{})
func (*StdLoggerWrapper) Warn ¶
func (w *StdLoggerWrapper) Warn(args ...interface{})
func (*StdLoggerWrapper) Warnf ¶
func (w *StdLoggerWrapper) Warnf(format string, args ...interface{})
Click to show internal directories.
Click to hide internal directories.