Documentation
¶
Overview ¶
Package logger @program: gin-template @author: [lliuhuan](https://github.com/lliuhuan) @create: 2024-07-02 22:12
Index ¶
- Constants
- func NewJSONLogger(opts ...Option) (*zap.Logger, error)
- 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 默认日志级别 DefaultLevel = zapcore.InfoLevel // DefaultTimeLayout 默认时间格式 DefaultTimeLayout = time.RFC3339 )
Variables ¶
This section is empty.
Functions ¶
func NewJSONLogger ¶
NewJSONLogger 返回一个 json-encoder zap 记录器,
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 自定义设置配置
func WithDisableConsole ¶
func WithDisableConsole() Option
WithDisableConsole 禁止将日志写入 os.Stdout 或 os.Stderr
func WithFileRotationP ¶
WithFileRotationP 将日志写入某个文件, 并且进行日志切割
Click to show internal directories.
Click to hide internal directories.