Documentation ¶
Index ¶
- Variables
- func NewFieldLog(opt ...Option) *fieldLogger
- type Field
- type Level
- type OUTPUT_FORMAT
- type Option
- func WithColors(color bool) Option
- func WithCtxTraceExtractor(fn func(ctx context.Context) string) Option
- func WithFilePath(enabled bool) Option
- func WithFuncPath(enabled bool) Option
- func WithLevelEncoder(enc func(Level, zapcore.PrimitiveArrayEncoder)) Option
- func WithLogLevel(lvl Level) Option
- func WithName(name string) Option
- func WithOutputFormat(o OUTPUT_FORMAT) Option
- func WithSkipFrameCount(c int) Option
- func WithStdOut(w io.Writer) Option
- func WithTimeEncoder(enc func(time.Time, zapcore.PrimitiveArrayEncoder)) Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Skip = zap.Skip Binary = zap.Binary Bool = zap.Bool Boolp = zap.Boolp ByteString = zap.ByteString 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 Strings = zap.Strings 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 Uintptrs = zap.Uintptrs Time = zap.Time Timep = zap.Timep Times = zap.Times Duration = zap.Duration Durationp = zap.Durationp Durations = zap.Durations NamedError = zap.NamedError Errors = zap.Errors Stringer = zap.Stringer Reflect = zap.Reflect Any = zap.Any )
View Source
var ( LowercaseLevelEncoder = zapcore.LowercaseLevelEncoder LowercaseColorLevelEncoder = zapcore.LowercaseColorLevelEncoder CapitalLevelEncoder = zapcore.CapitalLevelEncoder CapitalColorLevelEncoder = zapcore.CapitalColorLevelEncoder )
Level encoders to serialize levels
View Source
var ( EpochTimeEncoder = zapcore.EpochTimeEncoder EpochMillisTimeEncoder = zapcore.EpochMillisTimeEncoder EpochNanosTimeEncoder = zapcore.EpochNanosTimeEncoder ISO8601TimeEncoder = zapcore.ISO8601TimeEncoder RFC3339TimeEncoder = zapcore.RFC3339TimeEncoder RFC3339NanoTimeEncoder = zapcore.RFC3339NanoTimeEncoder )
View Source
var TimeEncoderOfLayout = zapcore.TimeEncoderOfLayout
create a time encoder from layouts
Functions ¶
Types ¶
type Level ¶
const ( DEBUG Level = zap.DebugLevel INFO Level = zap.InfoLevel WARN Level = zap.WarnLevel ERROR Level = zap.ErrorLevel DPANIC Level = zap.DPanicLevel PANIC Level = zap.PanicLevel FATAL Level = zap.FatalLevel )
type OUTPUT_FORMAT ¶
type OUTPUT_FORMAT string
const ( TextFormat OUTPUT_FORMAT = `text` JSONFormat OUTPUT_FORMAT = `json` )
type Option ¶
type Option func(*logOptions)
func WithCtxTraceExtractor ¶
WithCtxTraceExtractor allows setting up of a function to extract trace from the context. Default value func(_ context.Context) string{return ""}
func WithFilePath ¶
WithFilePath sets whether the file path is logged or not.
func WithFuncPath ¶
WithFuncPath sets whether the function name is logged or not.
func WithLevelEncoder ¶
func WithLevelEncoder(enc func(Level, zapcore.PrimitiveArrayEncoder)) Option
func WithLogLevel ¶
WithLogLevel sets the log level.
This would determine what types of logs would be logged based on the precedence of the log level
func WithOutputFormat ¶
func WithOutputFormat(o OUTPUT_FORMAT) Option
WithOutput sets the output format for log entries. Either JSON or text based.
func WithSkipFrameCount ¶
WithSkipFrameCount sets the frame count to skip when reading filepath, func path.
func WithTimeEncoder ¶
func WithTimeEncoder(enc func(time.Time, zapcore.PrimitiveArrayEncoder)) Option
Click to show internal directories.
Click to hide internal directories.