Documentation ¶
Overview ¶
Package gzap Created by guoxin in 2020/4/13 1:34 下午
Package gzap Create by guoxin 2020.12.15
Package core Create by guoxin 2021.07.02 ¶
Package gzap Create by guoxin 2020.12.15 TODO 这里考虑下之后是否需要实现
Index ¶
- Constants
- func GetInstance() *zap.Logger
- func GetRequestIdFromLocal() string
- func ISOTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
- func New(params ...interface{})
- func SetRequestIdFromLocal(requestId string)
- type Configuration
- type Console
- type EncoderConfig
- type File
- type Files
- type Logger
Constants ¶
View Source
const RequestIdKey = "request_id"
Variables ¶
This section is empty.
Functions ¶
func GetInstance ¶
func GetRequestIdFromLocal ¶
func GetRequestIdFromLocal() string
func ISOTimeEncoder ¶
func ISOTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)
func SetRequestIdFromLocal ¶
func SetRequestIdFromLocal(requestId string)
Types ¶
type Configuration ¶
type Configuration struct { core.InitializeLock Console Console `mapstructure:"console"` Files []File `mapstructure:"files"` AddCallerSkip int `mapstructure:"addCallerSkip"` RequestId bool `mapstructure:"requestId"` }
func (*Configuration) Initialize ¶
func (c *Configuration) Initialize(params ...interface{}) interface{}
type Console ¶
type Console struct { core.InitializeLock core.BEnable `mapstructure:",squash"` Level string `mapstructure:"level"` Encoder EncoderConfig `mapstructure:"encoder"` }
type EncoderConfig ¶
type EncoderConfig struct { // Set the keys used for each log entry. If any key is empty, that portion // of the entry is omitted. MessageKey string `json:"messageKey" mapstructure:"messageKey"` LevelKey string `json:"levelKey" mapstructure:"levelKey"` TimeKey string `json:"timeKey" mapstructure:"timeKey"` NameKey string `json:"nameKey" mapstructure:"nameKey"` CallerKey string `json:"callerKey" mapstructure:"callerKey"` StacktraceKey string `json:"stacktraceKey" mapstructure:"stacktraceKey"` LineEnding string `json:"lineEnding" mapstructure:"lineEnding"` // Configure the primitive representations of common complex types. For // example, some users may want all time.Times serialized as floating-point // seconds since epoch, while others may prefer ISO8601 strings. TimeFormat string `json:"timeFormat" mapstructure:"timeFormat"` }
type File ¶
type File struct { core.BEnable `mapstructure:",squash"` Level string `mapstructure:"level"` Encoder EncoderConfig `mapstructure:"encoder"` Logger Logger `mapstructure:"logger"` }
type Logger ¶
type Logger struct { Filename string `json:"filename" mapstructure:"filename"` MaxSize int `json:"maxsize" mapstructure:"maxsize"` MaxAge int `json:"maxage" mapstructure:"maxage"` MaxBackups int `json:"maxbackups" mapstructure:"maxbackups"` LocalTime bool `json:"localtime" mapstructure:"localtime"` Compress bool `json:"compress" mapstructure:"compress"` }
Logger See lumberjack.Logger
Click to show internal directories.
Click to hide internal directories.