Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithTraceId() context.Context
- func ContextWithTraceIdFromParent(parent context.Context) context.Context
- func Debug(ctx context.Context, msg string, args ...interface{})
- func Error(ctx context.Context, msg string, args ...interface{})
- func ErrorStack(ctx context.Context, msg string, args ...interface{})
- func GetLogLevel() zapcore.Level
- func Info(ctx context.Context, msg string, args ...interface{})
- func Log(ctx context.Context, level zapcore.Level, msg string, args ...interface{})
- func LogLess() zapcore.Level
- func LogMore() zapcore.Level
- func NewTraceId() string
- func Recover(ctx context.Context, errHandler func(interface{}) string)
- func SetLogLevel(lvl zapcore.Level) zapcore.Level
- func Warn(ctx context.Context, msg string, args ...interface{})
- type DefaultFieldsGenerator
- type IFieldsGenerator
- type ILog
- type ZapLogImpl
- func (l *ZapLogImpl) Debug(ctx context.Context, msg string, args ...interface{})
- func (l *ZapLogImpl) Error(ctx context.Context, msg string, args ...interface{})
- func (l *ZapLogImpl) ErrorStack(ctx context.Context, msg string, args ...interface{})
- func (l *ZapLogImpl) GetLogLevel() zapcore.Level
- func (l *ZapLogImpl) Info(ctx context.Context, msg string, args ...interface{})
- func (l *ZapLogImpl) Log(ctx context.Context, level zapcore.Level, msg string, args ...interface{})
- func (l *ZapLogImpl) LogLess() zapcore.Level
- func (l *ZapLogImpl) LogMore() zapcore.Level
- func (l *ZapLogImpl) Recover(ctx context.Context, errHandler func(interface{}) string)
- func (l *ZapLogImpl) SetLogLevel(lvl zapcore.Level) zapcore.Level
- func (l *ZapLogImpl) Warn(ctx context.Context, msg string, args ...interface{})
Constants ¶
View Source
const ( LOGGER_ENCODER_JSON = "json" LOGGER_ENCODER_CONSOLE = "console" )
Variables ¶
View Source
var LOG_TRACE_CTX_KEY = "__GTraceId__"
View Source
var LogImpl = NewZapLogImpl()
Functions ¶
func ContextWithTraceId ¶ added in v1.3.5
func ContextWithTraceIdFromParent ¶ added in v1.3.5
func ErrorStack ¶ added in v1.1.25
func GetLogLevel ¶ added in v1.3.5
func NewTraceId ¶ added in v1.3.5
func NewTraceId() string
Types ¶
type DefaultFieldsGenerator ¶ added in v1.1.29
func (*DefaultFieldsGenerator) Generate ¶ added in v1.3.6
func (f *DefaultFieldsGenerator) Generate(ctx context.Context) []zapcore.Field
func (*DefaultFieldsGenerator) GenerateStr ¶ added in v1.3.6
func (f *DefaultFieldsGenerator) GenerateStr(context.Context) string
type IFieldsGenerator ¶ added in v1.3.6
type IFieldsGenerator interface { Generate(context.Context) []zapcore.Field GenerateStr(context.Context) string }
IFieldsGenerator default json field
var BaseFieldsGenerator IFieldsGenerator = &DefaultFieldsGenerator{Nop: make([]zapcore.Field, 0)}
type ILog ¶ added in v1.3.6
type ILog interface { Log(context.Context, zapcore.Level, string, ...interface{}) Debug(context.Context, string, ...interface{}) Info(context.Context, string, ...interface{}) Warn(context.Context, string, ...interface{}) Error(context.Context, string, ...interface{}) Recover(context.Context, func(interface{}) string) ErrorStack(context.Context, string, ...interface{}) GetLogLevel() zapcore.Level SetLogLevel(zapcore.Level) zapcore.Level LogMore() zapcore.Level LogLess() zapcore.Level }
func NewZapLogImpl ¶ added in v1.3.6
func NewZapLogImpl() ILog
type ZapLogImpl ¶ added in v1.3.6
type ZapLogImpl struct {
// contains filtered or unexported fields
}
func (*ZapLogImpl) Debug ¶ added in v1.3.6
func (l *ZapLogImpl) Debug(ctx context.Context, msg string, args ...interface{})
func (*ZapLogImpl) Error ¶ added in v1.3.6
func (l *ZapLogImpl) Error(ctx context.Context, msg string, args ...interface{})
func (*ZapLogImpl) ErrorStack ¶ added in v1.3.6
func (l *ZapLogImpl) ErrorStack(ctx context.Context, msg string, args ...interface{})
func (*ZapLogImpl) GetLogLevel ¶ added in v1.3.6
func (l *ZapLogImpl) GetLogLevel() zapcore.Level
func (*ZapLogImpl) Info ¶ added in v1.3.6
func (l *ZapLogImpl) Info(ctx context.Context, msg string, args ...interface{})
func (*ZapLogImpl) LogLess ¶ added in v1.3.6
func (l *ZapLogImpl) LogLess() zapcore.Level
func (*ZapLogImpl) LogMore ¶ added in v1.3.6
func (l *ZapLogImpl) LogMore() zapcore.Level
func (*ZapLogImpl) Recover ¶ added in v1.3.6
func (l *ZapLogImpl) Recover(ctx context.Context, errHandler func(interface{}) string)
func (*ZapLogImpl) SetLogLevel ¶ added in v1.3.6
func (l *ZapLogImpl) SetLogLevel(lvl zapcore.Level) zapcore.Level
Click to show internal directories.
Click to hide internal directories.