Documentation ¶
Index ¶
- Constants
- func NewJSONLogger(opts ...Option) *zap.Logger
- type Option
- func WithDebugLevel() Option
- func WithEnableConsole() Option
- func WithErrorLevel() Option
- func WithField(key, value string) Option
- func WithFilePath(filename string) Option
- func WithFileRotationP(filename string) Option
- func WithIOWriter(writer io.Writer) Option
- func WithInfoLevel() Option
- func WithTimeLayout(timeLayout string) Option
- func WithWarnLevel() Option
Constants ¶
View Source
const ( // DefaultLevel the default log level DefaultLevel = zapcore.DebugLevel // DefaultTimeLayout the default time layout DefaultTimeLayout = timeutils.CSTLayout )
Variables ¶
This section is empty.
Functions ¶
func NewJSONLogger ¶
NewJSONLogger return a json-encoder zap logger,
Types ¶
type Option ¶
type Option func(*option)
Option custom setup config
func WithDebugLevel ¶
func WithDebugLevel() Option
WithDebugLevel only greater than 'level' will output
func WithEnableConsole ¶
func WithEnableConsole() Option
WithEnableConsole enable 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.