logger

package
v0.0.0-...-4e7898a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log = initLogger()

Log is the default logger

Functions

func CustomLevelEncoder

func CustomLevelEncoder(level zapcore.Level, enc zapcore.PrimitiveArrayEncoder)

func CustomNameEncoder

func CustomNameEncoder(loggerName string, enc zapcore.PrimitiveArrayEncoder)

func CustomTimeEncoder

func CustomTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)

func SetLogger

func SetLogger(l *Logger)

SetLogger rewrites the default logger

func ShortCallerEncoder

func ShortCallerEncoder(caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder)

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config log配置文件

func (*Config) DisableConsoleOut

func (c *Config) DisableConsoleOut()

DisableConsoleOut 关闭Console输出

func (*Config) DisableJSONFormat

func (c *Config) DisableJSONFormat()

DisableJSONFormat 关闭JSON格式化输出

func (*Config) EnableConsoleOut

func (c *Config) EnableConsoleOut()

EnableConsoleOut 开启Console输出

func (*Config) EnableJSONFormat

func (c *Config) EnableJSONFormat()

EnableJSONFormat 开启JSON格式化输出

func (*Config) SetCallerSkip

func (c *Config) SetCallerSkip(callerSkip int)

SetCallerSkip 设置callerSkip次数

func (*Config) SetFileOut

func (c *Config) SetFileOut(path, name string, rotationTime, rotationCount uint)

SetFileOut 设置日志输出文件

func (*Config) SetLevel

func (c *Config) SetLevel(level string)

SetLevel 设置日志记录级别

func (*Config) SetProjectName

func (c *Config) SetProjectName(projectName string)

SetProjectName 设置ProjectName

func (*Config) SetStacktraceLevel

func (c *Config) SetStacktraceLevel(level string)

SetStacktraceLevel 设置堆栈跟踪的日志级别

type Logger

type Logger struct {
	Config *Config
	// contains filtered or unexported fields
}

Logger Logger

func New

func New() *Logger

New New Logger

func (*Logger) ApplyConfig

func (l *Logger) ApplyConfig()

ApplyConfig 应用当前Config配置

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

Debug Debug log

func (*Logger) Debugf

func (l *Logger) Debugf(template string, args ...interface{})

Debugf Debug format log

func (*Logger) Debugw

func (l *Logger) Debugw(msg string, keysAndValues ...interface{})

Debugw Debugw log

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

Error Error log

func (*Logger) Errorf

func (l *Logger) Errorf(template string, args ...interface{})

Errorf Error format log

func (*Logger) Errorw

func (l *Logger) Errorw(msg string, keysAndValues ...interface{})

Errorw Errorw log

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

Fatal Fatal log

func (*Logger) Fatalf

func (l *Logger) Fatalf(template string, args ...interface{})

Fatalf Fatal format log

func (*Logger) Fatalw

func (l *Logger) Fatalw(msg string, keysAndValues ...interface{})

Fatalw Fatalw log

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

Info Info log

func (*Logger) Infof

func (l *Logger) Infof(template string, args ...interface{})

Infof Info format log

func (*Logger) Infow

func (l *Logger) Infow(msg string, keysAndValues ...interface{})

Infow Infow log

func (*Logger) Panic

func (l *Logger) Panic(args ...interface{})

Panic Panic log

func (*Logger) Panicf

func (l *Logger) Panicf(template string, args ...interface{})

Panicf Panic format log

func (*Logger) Panicw

func (l *Logger) Panicw(msg string, keysAndValues ...interface{})

Panicw Panicw log

func (*Logger) Warn

func (l *Logger) Warn(args ...interface{})

Warn Warn log

func (*Logger) Warnf

func (l *Logger) Warnf(template string, args ...interface{})

Warnf Warn format log

func (*Logger) Warnw

func (l *Logger) Warnw(msg string, keysAndValues ...interface{})

Warnw Warnw log

func (*Logger) With

func (l *Logger) With(args ...interface{}) *zap.SugaredLogger

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL