Documentation ¶
Index ¶
- Variables
- func Debug(a ...interface{})
- func Debugf(format string, a ...interface{})
- func Debugw(keyvals ...interface{})
- func DefaultZapEncoder() zapcore.Encoder
- func Error(a ...interface{})
- func Errorf(format string, a ...interface{})
- func Errorw(keyvals ...interface{})
- func Fatal(a ...interface{})
- func Fatalf(format string, a ...interface{})
- func Fatalw(keyvals ...interface{})
- func GetCommonLog(level Level, encoder zapcore.Encoder, ws ...zapcore.WriteSyncer) *zap.Logger
- func GetEasyModeLog(level Level, maxsize, maxBackups, maxAge int, compress, localTime bool) *zap.Logger
- func GetLogFilePath(storagePath string, levelName string) string
- func GetZapWriter(path string, maxsize, maxBackups, maxAge int, compress, localTime bool) io.Writer
- func Info(a ...interface{})
- func Infof(format string, a ...interface{})
- func Infow(keyvals ...interface{})
- func Log(level Level, keyvals ...interface{})
- func NewLogger(l Logger, opts ...Option) *logcat
- func SetLogger(logger Logger)
- func Value(ctx context.Context, v interface{}) interface{}
- func Warn(a ...interface{})
- func Warnf(format string, a ...interface{})
- func Warnw(keyvals ...interface{})
- type Filter
- type FilterOption
- type Level
- type Logger
- type Option
- type Valuer
- type ZapLogger
- type ZapOption
- func WithCompress(compress bool) ZapOption
- func WithEnableEasyMode(enable bool) ZapOption
- func WithEncoder(encoder zapcore.Encoder) ZapOption
- func WithLevel(level Level) ZapOption
- func WithMaxAge(maxAge int) ZapOption
- func WithMaxBackups(maxBackups int) ZapOption
- func WithMaxSize(maxSize int) ZapOption
- func WithWriteSyncer(writeSyncers ...zapcore.WriteSyncer) ZapOption
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultCaller is a Valuer that returns the file and line. DefaultCaller = Caller(4) // DefaultTimestamp is a Valuer that returns the current wallclock time. DefaultTimestamp = Timestamp(time.RFC3339) )
View Source
var ( ZapMaxSize = 10 //每个日志文件保存多少M,默认10M ZapMaxBackUps = 30 //保留多少个备份,默认不限 ZapMaxAge = 7 //保留多少天,默认不限 ZapCompress = true //是否压缩 ZapLocalTime = true //是否使用localTime )
View Source
var DefaultMessageKey = "msg"
View Source
var LogCat *logcat
Functions ¶
func GetCommonLog ¶
func GetEasyModeLog ¶
func GetEasyModeLog(level Level, maxsize, maxBackups, maxAge int, compress, localTime bool) *zap.Logger
简易模式设置
func GetLogFilePath ¶
根据存储路径和日志级别获取完整的日志文件路径
func GetZapWriter ¶
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
func NewFilter ¶
func NewFilter(logger Logger, opts ...FilterOption) *Filter
type FilterOption ¶
type FilterOption func(*Filter)
func FilterFunc ¶
func FilterFunc(f func(level Level, keyvals ...interface{}) bool) FilterOption
FilterFunc with filter func.
func FilterLevel ¶
func FilterLevel(level Level) FilterOption
type Valuer ¶
Valuer is returns a log value.
type ZapLogger ¶
type ZapLogger struct {
// contains filtered or unexported fields
}
MaxSize 每个日志文件保存多少M,默认10M MaxBackups 保留多少个备份,默认不限 MaxAge 保留多少天,默认不限 Compress 是否压缩 LocalTime 是否使用localTime FileStoragePath 日志文件存放路径
func NewZapLogger ¶
type ZapOption ¶
type ZapOption func(options *ZapLogger)
func WithCompress ¶
func WithEnableEasyMode ¶
func WithEncoder ¶
func WithMaxAge ¶
func WithMaxBackups ¶
func WithMaxSize ¶
func WithWriteSyncer ¶
func WithWriteSyncer(writeSyncers ...zapcore.WriteSyncer) ZapOption
Click to show internal directories.
Click to hide internal directories.