Documentation ¶
Index ¶
- Constants
- Variables
- func NewContext(ctx context.Context, l Logger) context.Context
- func ResetDefault(l Logger)
- type Field
- type Level
- type Logger
- type Option
- type Valuer
- func App(v string) Valuer
- func Caller(depth int) Valuer
- func Component(v string) Valuer
- func File(depth int) Valuer
- func FromAny(key string, vf func(context.Context) any) Valuer
- func FromBinary(key string, vf func(context.Context) []byte) Valuer
- func FromBool(key string, vf func(context.Context) bool) Valuer
- func FromBoolp(key string, vf func(context.Context) *bool) Valuer
- func FromByteString(key string, vf func(context.Context) []byte) Valuer
- func FromComplex128(key string, vf func(context.Context) complex128) Valuer
- func FromComplex128p(key string, vf func(context.Context) *complex128) Valuer
- func FromComplex64(key string, vf func(context.Context) complex64) Valuer
- func FromComplex64p(key string, vf func(context.Context) *complex64) Valuer
- func FromDuration(key string, vf func(context.Context) time.Duration) Valuer
- func FromDurationp(key string, vf func(context.Context) *time.Duration) Valuer
- func FromFloat32(key string, vf func(context.Context) float32) Valuer
- func FromFloat32p(key string, vf func(context.Context) *float32) Valuer
- func FromFloat64(key string, vf func(context.Context) float64) Valuer
- func FromFloat64p(key string, vf func(context.Context) *float64) Valuer
- func FromInt(key string, vf func(context.Context) int) Valuer
- func FromInt16(key string, vf func(context.Context) int16) Valuer
- func FromInt16p(key string, vf func(context.Context) *int16) Valuer
- func FromInt32(key string, vf func(context.Context) int32) Valuer
- func FromInt32p(key string, vf func(context.Context) *int32) Valuer
- func FromInt64(key string, vf func(context.Context) int64) Valuer
- func FromInt64p(key string, vf func(context.Context) *int64) Valuer
- func FromInt8(key string, vf func(context.Context) int8) Valuer
- func FromInt8p(key string, vf func(context.Context) *int8) Valuer
- func FromIntp(key string, vf func(context.Context) *int) Valuer
- func FromNamespace(key string) Valuer
- func FromReflect(key string, vf func(context.Context) any) Valuer
- func FromStack(key string) Valuer
- func FromStackSkip(key string, skip int) Valuer
- func FromString(key string, vf func(context.Context) string) Valuer
- func FromStringer(key string, vf func(context.Context) fmt.Stringer) Valuer
- func FromStringp(key string, vf func(context.Context) *string) Valuer
- func FromTime(key string, vf func(context.Context) time.Time) Valuer
- func FromTimep(key string, vf func(context.Context) *time.Time) Valuer
- func FromUint(key string, vf func(context.Context) uint) Valuer
- func FromUint16(key string, vf func(context.Context) uint16) Valuer
- func FromUint16p(key string, vf func(context.Context) *uint16) Valuer
- func FromUint32(key string, vf func(context.Context) uint32) Valuer
- func FromUint32p(key string, vf func(context.Context) *uint32) Valuer
- func FromUint64(key string, vf func(context.Context) uint64) Valuer
- func FromUint64p(key string, vf func(context.Context) *uint64) Valuer
- func FromUint8(key string, vf func(context.Context) uint8) Valuer
- func FromUint8p(key string, vf func(context.Context) *uint8) Valuer
- func FromUintp(key string, vf func(context.Context) *uint) Valuer
- func FromUintptr(key string, vf func(context.Context) uintptr) Valuer
- func FromUintptrp(key string, vf func(context.Context) *uintptr) Valuer
- func ImmutAny(key string, v any) Valuer
- func ImmutBinary(key string, v []byte) Valuer
- func ImmutBool(key string, v bool) Valuer
- func ImmutBoolp(key string, v *bool) Valuer
- func ImmutByteString(key string, v []byte) Valuer
- func ImmutComplex128(key string, v complex128) Valuer
- func ImmutComplex128p(key string, v *complex128) Valuer
- func ImmutComplex64(key string, v complex64) Valuer
- func ImmutComplex64p(key string, v *complex64) Valuer
- func ImmutDuration(key string, v time.Duration) Valuer
- func ImmutDurationp(key string, v *time.Duration) Valuer
- func ImmutFloat32(key string, v float32) Valuer
- func ImmutFloat32p(key string, v *float32) Valuer
- func ImmutFloat64(key string, v float64) Valuer
- func ImmutFloat64p(key string, v *float64) Valuer
- func ImmutInt(key string, v int) Valuer
- func ImmutInt16(key string, v int16) Valuer
- func ImmutInt16p(key string, v *int16) Valuer
- func ImmutInt32(key string, v int32) Valuer
- func ImmutInt32p(key string, v *int32) Valuer
- func ImmutInt64(key string, v int64) Valuer
- func ImmutInt64p(key string, v *int64) Valuer
- func ImmutInt8(key string, v int8) Valuer
- func ImmutInt8p(key string, v *int8) Valuer
- func ImmutIntp(key string, v *int) Valuer
- func ImmutReflect(key string, v any) Valuer
- func ImmutString(key string, v string) Valuer
- func ImmutStringer(key string, v fmt.Stringer) Valuer
- func ImmutStringp(key string, v *string) Valuer
- func ImmutTime(key string, v time.Time) Valuer
- func ImmutTimep(key string, v *time.Time) Valuer
- func ImmutUint(key string, v uint) Valuer
- func ImmutUint16(key string, v uint16) Valuer
- func ImmutUint16p(key string, v *uint16) Valuer
- func ImmutUint32(key string, v uint32) Valuer
- func ImmutUint32p(key string, v *uint32) Valuer
- func ImmutUint64(key string, v uint64) Valuer
- func ImmutUint64p(key string, v *uint64) Valuer
- func ImmutUint8(key string, v uint8) Valuer
- func ImmutUint8p(key string, v *uint8) Valuer
- func ImmutUintp(key string, v *uint) Valuer
- func ImmutUintptr(key string, v uintptr) Valuer
- func ImmutUintptrp(key string, v *uintptr) Valuer
- func Kind(v string) Valuer
- func Module(v string) Valuer
- func Package(v string) Valuer
- func RequestId(f func(c context.Context) string) Valuer
- func TraceId(f func(c context.Context) string) Valuer
- func Type(v string) Valuer
- func Unit(v string) Valuer
Constants ¶
View Source
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel = zapcore.DebugLevel // InfoLevel is the default logging priority. InfoLevel = zapcore.InfoLevel // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel = zapcore.WarnLevel // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel = zapcore.ErrorLevel // DPanicLevel logs are particularly important errors. In development the // logger panics after writing the message. DPanicLevel = zapcore.DPanicLevel // PanicLevel logs a message, then panics. PanicLevel = zapcore.PanicLevel // FatalLevel logs a message, then calls os.Exit(1). FatalLevel = zapcore.FatalLevel )
Variables ¶
View Source
var ( GetLogger = defaultLogger.Logger SetLevel = defaultLogger.SetLevel Enabled = defaultLogger.Enabled V = defaultLogger.V WithContext = defaultLogger.WithContext WithField = defaultLogger.WithField WithMap = defaultLogger.WithMap WithName = defaultLogger.WithName Debug = defaultLogger.Debug Debugf = defaultLogger.Debugf Debugw = defaultLogger.Debugw Info = defaultLogger.Info Infof = defaultLogger.Infof Infow = defaultLogger.Infow Warn = defaultLogger.Warn Warnf = defaultLogger.Warnf Warnw = defaultLogger.Warnw Error = defaultLogger.Error Errorf = defaultLogger.Errorf Errorw = defaultLogger.Errorw DPanic = defaultLogger.DPanic DPanicf = defaultLogger.DPanicf DPanicw = defaultLogger.DPanicw Panic = defaultLogger.Panic Panicf = defaultLogger.Panicf Panicw = defaultLogger.Panicw Fatal = defaultLogger.Fatal Fatalf = defaultLogger.Fatalf Fatalw = defaultLogger.Fatalw Flush = defaultLogger.Flush )
View Source
var ( Skip = zap.Skip Binary = zap.Binary Bool = zap.Bool Boolp = zap.Boolp ByteString = zap.ByteString Complex128 = zap.Complex128 Complex128p = zap.Complex128p Complex64 = zap.Complex64 Complex64p = zap.Complex64p Float64 = zap.Float64 Float64p = zap.Float64p Float32 = zap.Float32 Float32p = zap.Float32p Int = zap.Int Intp = zap.Intp Int64 = zap.Int64 Int64p = zap.Int64p Int32 = zap.Int32 Int32p = zap.Int32p Int16 = zap.Int16 Int16p = zap.Int16p Int8 = zap.Int8 Int8p = zap.Int8p String = zap.String Stringp = zap.Stringp Uint = zap.Uint Uintp = zap.Uintp Uint64 = zap.Uint64 Uint64p = zap.Uint64p Uint32 = zap.Uint32 Uint32p = zap.Uint32p Uint16 = zap.Uint16 Uint16p = zap.Uint16p Uint8 = zap.Uint8 Uint8p = zap.Uint8p Uintptr = zap.Uintptr Uintptrp = zap.Uintptrp Reflect = zap.Reflect Namespace = zap.Namespace Stringer = zap.Stringer Time = zap.Time Timep = zap.Timep Stack = zap.Stack StackSkip = zap.StackSkip Duration = zap.Duration Durationp = zap.Durationp Any = zap.Any )
Functions ¶
func ResetDefault ¶
func ResetDefault(l Logger)
Types ¶
type Logger ¶
type Logger interface { Enabled(lvl zapcore.Level) bool V(lvl int) bool Logger() *zap.Logger SetLevel(lv Level) Debug(v any, fields ...Field) Debugf(format string, v ...interface{}) Debugw(v any, keysAndValues ...interface{}) Info(v any, fields ...Field) Infof(format string, v ...interface{}) Infow(v any, keysAndValues ...interface{}) Warn(v any, fields ...Field) Warnf(format string, v ...interface{}) Warnw(v any, keysAndValues ...interface{}) Error(v any, fields ...Field) Errorf(format string, v ...interface{}) Errorw(v any, keysAndValues ...interface{}) DPanic(v any, fields ...Field) DPanicf(format string, v ...interface{}) DPanicw(v any, keysAndValues ...interface{}) Panic(v any, fields ...Field) Panicf(format string, v ...interface{}) Panicw(v any, keysAndValues ...interface{}) Fatal(v any, fields ...Field) Fatalf(format string, v ...interface{}) Fatalw(v any, keysAndValues ...interface{}) WithField(fields ...Field) Logger WithName(name string) Logger WithContext(ctx context.Context, keys ...string) Logger WithMap(fields map[string]any) Logger Flush() error }
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
func Development ¶
func Development() Option
func WithCaller ¶
func WithCallerSkip ¶
type Valuer ¶
Valuer is returns a log value.
func FromComplex128 ¶
func FromComplex128(key string, vf func(context.Context) complex128) Valuer
func FromComplex128p ¶
func FromComplex128p(key string, vf func(context.Context) *complex128) Valuer
func FromNamespace ¶
func FromStackSkip ¶
func ImmutBinary ¶
func ImmutBoolp ¶
func ImmutByteString ¶
func ImmutComplex128 ¶
func ImmutComplex128(key string, v complex128) Valuer
func ImmutComplex128p ¶
func ImmutComplex128p(key string, v *complex128) Valuer
func ImmutComplex64 ¶
func ImmutComplex64p ¶
func ImmutFloat32 ¶
func ImmutFloat32p ¶
func ImmutFloat64 ¶
func ImmutFloat64p ¶
func ImmutInt16 ¶
func ImmutInt16p ¶
func ImmutInt32 ¶
func ImmutInt32p ¶
func ImmutInt64 ¶
func ImmutInt64p ¶
func ImmutInt8p ¶
func ImmutReflect ¶
func ImmutString ¶
func ImmutStringp ¶
func ImmutUint16 ¶
func ImmutUint16p ¶
func ImmutUint32 ¶
func ImmutUint32p ¶
func ImmutUint64 ¶
func ImmutUint64p ¶
func ImmutUint8 ¶
func ImmutUint8p ¶
func ImmutUintp ¶
func ImmutUintptr ¶
func ImmutUintptrp ¶
Click to show internal directories.
Click to hide internal directories.