Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(msg string, fields ...zap.Field)
- func Error(msg string, fields ...zap.Field)
- func GetLogger() *zap.Logger
- func Info(msg string, fields ...zap.Field)
- func InitLogger(opts ...Option) *zap.Logger
- func Sync()
- func Warn(msg string, fields ...zap.Field)
- func WrapMeta(err error, metas ...Meta) (fields []zap.Field)
- type Meta
- type Option
- func WithDebugLevel() Option
- func WithDisableConsole() Option
- func WithErrorLevel() Option
- func WithField(key, value string) Option
- func WithFileP(file string) Option
- func WithFileRotationP(file string) Option
- func WithInfoLevel() Option
- func WithTimeLayout(timeLayout string) Option
- func WithWarnLevel() Option
Constants ¶
View Source
const ( // DefaultLevel the default log level DefaultLevel = zapcore.InfoLevel // DefaultTimeLayout the default time layout; DefaultTimeLayout = time.RFC3339 )
Variables ¶
View Source
var Logger *zap.Logger
Functions ¶
Types ¶
type Meta ¶
type Meta interface { Key() string Value() interface{} // contains filtered or unexported methods }
Meta key-value
type Option ¶
type Option func(*option)
Option custom setup config
func WithDebugLevel ¶
func WithDebugLevel() Option
WithDebugLevel only greater than 'level' will output
func WithDisableConsole ¶
func WithDisableConsole() Option
WithDisableConsole WithEnableConsole write log to os.Stdout or os.Stderr
func WithErrorLevel ¶
func WithErrorLevel() Option
WithErrorLevel only greater than 'level' will output
func WithFileRotationP ¶
WithFileRotationP write log to some file with rotation
func WithInfoLevel ¶
func WithInfoLevel() Option
WithInfoLevel only greater than 'level' will output
func WithTimeLayout ¶
WithTimeLayout custom time format
func WithWarnLevel ¶
func WithWarnLevel() Option
WithWarnLevel only greater than 'level' will output
Click to show internal directories.
Click to hide internal directories.