Documentation
¶
Index ¶
- func New(logger *zap.Logger, config *Configuration) (*zap.Logger, *zap.Logger)
- func NewJSONFileLogger(logger *zap.Logger, config *Configuration, level zapcore.Level, ...) *zap.Logger
- func NewJSONLogger(output *os.File, level zapcore.Level, format LoggingFormat) *zap.Logger
- func NewMultiLogger(loggers ...*zap.Logger) *zap.Logger
- func NewRotatingJSONFileLogger(logger *zap.Logger, config *Configuration, level zapcore.Level, ...) *zap.Logger
- func RedirectStdLog(logger *zap.Logger)
- func StackdriverLevelEncoder(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
- type Configuration
- type LoggingFormat
- type RedirectStdLogWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewJSONFileLogger ¶
func NewJSONFileLogger(logger *zap.Logger, config *Configuration, level zapcore.Level, format LoggingFormat) *zap.Logger
NewJSONFileLogger file
func NewJSONLogger ¶
NewJSONLogger 创建json格式输出日志
func NewRotatingJSONFileLogger ¶
func NewRotatingJSONFileLogger(logger *zap.Logger, config *Configuration, level zapcore.Level, format LoggingFormat) *zap.Logger
NewRotatingJSONFileLogger 创建滚动式日志文件存储
func RedirectStdLog ¶
func StackdriverLevelEncoder ¶
func StackdriverLevelEncoder(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
StackdriverLevelEncoder stackdriver Level encoder
Types ¶
type Configuration ¶
type Configuration struct { Level string `yaml:"level" json:"level" usage:"Log level to set. Valid values are 'debug', 'info', 'warn', 'error'. Default 'info'."` Stdout bool `yaml:"stdout" json:"stdout" usage:"Log to standard console output (as well as to a file if set). Default true."` File string `` /* 135-byte string literal not displayed */ Rotation bool `yaml:"rotation" json:"rotation" usage:"Rotate log files. Default is false."` MaxSize int `` /* 139-byte string literal not displayed */ MaxAge int `` /* 195-byte string literal not displayed */ MaxBackups int `` /* 188-byte string literal not displayed */ LocalTime bool `` /* 184-byte string literal not displayed */ Compress bool `yaml:"compress" json:"compress" usage:"This determines if the rotated log files should be compressed using gzip."` Format string `yaml:"format" json:"format" usage:"Set logging output format. Can either be 'JSON' or 'Stackdriver'. Default is 'JSON'."` }
Configuration 日志配置信息
func NewConfiguration ¶
func NewConfiguration() *Configuration
type LoggingFormat ¶
type LoggingFormat int8
定义日志输出格式
const ( // JSONFormat json格式输出 JSONFormat LoggingFormat = iota - 1 // StackdriverFormat Stackdriver StackdriverFormat )
type RedirectStdLogWriter ¶
type RedirectStdLogWriter struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.