Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(msg string, fields ...Field)
- func Debugf(format string, args ...any)
- func Error(msg string, fields ...Field)
- func Errorf(format string, args ...any)
- func Fatal(msg string, fields ...Field)
- func Fatalf(format string, args ...any)
- func Info(msg string, fields ...Field)
- func Infof(format string, args ...any)
- func New(opts ...Option)
- func NewDevelopment(opts ...Option)
- func SetLevel(lv string)
- func SugaredLogger() *zap.SugaredLogger
- func Warn(msg string, fields ...Field)
- func Warnf(format string, args ...any)
- type Field
- type Logger
- type Option
- func AddCallerSkip(skip int) Option
- func WithCaller(enabled bool) Option
- func WithDisableConsole() Option
- func WithEncode(encode string) Option
- func WithFileP(file string) Option
- func WithFileRotationP(file string) Option
- func WithLevel(level string) Option
- func WithTimeLayout(timeLayout string) Option
Constants ¶
View Source
const ( // DefaultLevel the default log level DefaultLevel = zapcore.InfoLevel // DefaultTimeLayout the default time layout; DefaultTimeLayout = "2006-01-02 15:04:05.000" )
Variables ¶
View Source
var ( Any = zap.Any Array = zap.Array Object = zap.Object Binary = zap.Binary Bool = zap.Bool Bools = zap.Bools ByteString = zap.ByteString ByteStrings = zap.ByteStrings Complex64 = zap.Complex64 Complex64s = zap.Complex64s Complex128 = zap.Complex128 Complex128s = zap.Complex128s Duration = zap.Duration Durations = zap.Durations Err = zap.Error Errors = zap.Errors Float32 = zap.Float32 Float32s = zap.Float32s Float64 = zap.Float64 Float64s = zap.Float64s Int = zap.Int Ints = zap.Ints Int8 = zap.Int8 Int8s = zap.Int8s Int16 = zap.Int16 Int16s = zap.Int16s Int32 = zap.Int32 Int32s = zap.Int32s Int64 = zap.Int64 Int64s = zap.Int64s Namespace = zap.Namespace Reflect = zap.Reflect Stack = zap.Stack String = zap.String Stringer = zap.Stringer Strings = zap.Strings Time = zap.Time Times = zap.Times Uint = zap.Uint Uints = zap.Uints Uint8 = zap.Uint8 Uint8s = zap.Uint8s Uint16 = zap.Uint16 Uint16s = zap.Uint16s Uint32 = zap.Uint32 Uint32s = zap.Uint32s Uint64 = zap.Uint64 Uint64s = zap.Uint64s Uintptr = zap.Uintptr Uintptrs = zap.Uintptrs )
Alias for zap type functions.
Functions ¶
func NewDevelopment ¶
func NewDevelopment(opts ...Option)
func SugaredLogger ¶
func SugaredLogger() *zap.SugaredLogger
Types ¶
type Logger ¶
type Logger interface { Debug(msg string, fields ...Field) Info(msg string, fields ...Field) Warn(msg string, fields ...Field) Error(msg string, fields ...Field) Fatal(msg string, fields ...Field) Debugf(format string, args ...any) Infof(format string, args ...any) Warnf(format string, args ...any) Errorf(format string, args ...any) Fatalf(format string, args ...any) }
func WithFields ¶
type Option ¶
type Option func(*option)
Option custom setup config
func AddCallerSkip ¶
func WithCaller ¶
func WithDisableConsole ¶
func WithDisableConsole() Option
WithDisableConsole WithEnableConsole write log to os.Stdout or os.Stderr
func WithEncode ¶
func WithFileRotationP ¶
WithFileRotationP write log to some file with rotation
func WithTimeLayout ¶
WithTimeLayout custom time format
Click to show internal directories.
Click to hide internal directories.