Documentation
¶
Index ¶
- Constants
- func AddFieldFunc(f func(context.Context, map[string]interface{}))
- func Debug(args ...interface{})
- func DebugContext(ctx context.Context, template string, args ...interface{})
- func DebugContextWithFields(ctx context.Context, fields map[string]interface{}, template string, ...)
- func DebugWithFields(fields map[string]interface{}, template string, args ...interface{})
- func Debugf(template string, args ...interface{})
- func Error(args ...interface{})
- func ErrorContext(ctx context.Context, template string, args ...interface{})
- func ErrorContextWithFields(ctx context.Context, fields map[string]interface{}, template string, ...)
- func ErrorWithFields(fields map[string]interface{}, template string, args ...interface{})
- func Errorf(template string, args ...interface{})
- func Fatal(args ...interface{})
- func FatalContext(ctx context.Context, template string, args ...interface{})
- func FatalContextWithFields(ctx context.Context, fields map[string]interface{}, template string, ...)
- func FatalWithFields(fields map[string]interface{}, template string, args ...interface{})
- func Fatalf(template string, args ...interface{})
- func GetCallerShort() (short bool)
- func GetCallerSkip() (skip int)
- func GetFileRotate() (maxSizeMB int, maxBackups int, maxAgeDay int)
- func GetIsOutputStdout() (isOutputStdout bool)
- func GetName() (name string)
- func GetOutputFile() (logPath, fileName string)
- func GetOutputJson() (json bool)
- func GetZapLogger() *zap.Logger
- func GetZapSugaredLogger() *zap.SugaredLogger
- func Info(args ...interface{})
- func InfoContext(ctx context.Context, template string, args ...interface{})
- func InfoContextWithFields(ctx context.Context, fields map[string]interface{}, template string, ...)
- func InfoWithFields(fields map[string]interface{}, template string, args ...interface{})
- func Infof(template string, args ...interface{})
- func InitLogger()
- func Panic(args ...interface{})
- func PanicContext(ctx context.Context, template string, args ...interface{})
- func PanicContextWithFields(ctx context.Context, fields map[string]interface{}, template string, ...)
- func PanicWithFields(fields map[string]interface{}, template string, args ...interface{})
- func Panicf(template string, args ...interface{})
- func Sync() error
- func Warn(args ...interface{})
- func WarnContext(ctx context.Context, template string, args ...interface{})
- func WarnContextWithFields(ctx context.Context, fields map[string]interface{}, template string, ...)
- func WarnWithFields(fields map[string]interface{}, template string, args ...interface{})
- func Warnf(template string, args ...interface{})
- type Level
- type LoggerInterface
- func Logger() LoggerInterface
- func New() LoggerInterface
- func SetCallerCallerSkip(skip int) LoggerInterface
- func SetCallerShort(short bool) LoggerInterface
- func SetFileRotate(maxSizeMB int, maxBackups int, maxAgeDay int) LoggerInterface
- func SetIsOutputStdout(isOutputStdout bool) LoggerInterface
- func SetLevel(level Level) LoggerInterface
- func SetName(name string) LoggerInterface
- func SetOutputFile(logPath, fileName string) LoggerInterface
- func SetOutputJson(json bool) LoggerInterface
Constants ¶
View Source
const ( DebugLevel = zapcore.DebugLevel InfoLevel = zapcore.InfoLevel WarnLevel = zapcore.WarnLevel ErrorLevel = zapcore.ErrorLevel )
Variables ¶
This section is empty.
Functions ¶
func AddFieldFunc ¶
func DebugContext ¶
func DebugContextWithFields ¶
func DebugWithFields ¶
func ErrorContext ¶
func ErrorContextWithFields ¶
func ErrorWithFields ¶
func FatalContext ¶
func FatalContextWithFields ¶
func FatalWithFields ¶
func GetCallerShort ¶
func GetCallerShort() (short bool)
func GetCallerSkip ¶
func GetCallerSkip() (skip int)
func GetFileRotate ¶
func GetIsOutputStdout ¶
func GetIsOutputStdout() (isOutputStdout bool)
func GetOutputFile ¶
func GetOutputFile() (logPath, fileName string)
func GetOutputJson ¶
func GetOutputJson() (json bool)
func GetZapLogger ¶
func GetZapSugaredLogger ¶
func GetZapSugaredLogger() *zap.SugaredLogger
func InfoContext ¶
func InfoContextWithFields ¶
func InfoWithFields ¶
func InitLogger ¶
func InitLogger()
func PanicContext ¶
func PanicContextWithFields ¶
func PanicWithFields ¶
func WarnContext ¶
func WarnContextWithFields ¶
func WarnWithFields ¶
Types ¶
type Level ¶
func StringLevel ¶
type LoggerInterface ¶
type LoggerInterface interface {
SetOutputFile(logPath, fileName string) LoggerInterface
SetFileRotate(maxSizeMB int, maxBackups int, maxAgeDay int) LoggerInterface
SetLevel(level Level) LoggerInterface
SetCallerShort(short bool) LoggerInterface
SetName(name string) LoggerInterface
SetIsOutputStdout(isOutputStdout bool) LoggerInterface
SetCallerSkip(skip int) LoggerInterface
SetOutputJson(json bool) LoggerInterface
GetOutputFile() (logPath, fileName string)
GetFileRotate() (maxSizeMB int, maxBackups int, maxAgeDay int)
GetLevel() (level Level)
GetCallerShort() (short bool)
GetName() (name string)
GetIsOutputStdout() (isOutputStdout bool)
GetCallerSkip() (skip int)
GetOutputJson() bool
// InitLogger init logger should call this when change config
InitLogger()
// Sync terminal the logger should call this to flush
Sync() error
Panicf(template string, args ...interface{})
Fatalf(template string, args ...interface{})
Errorf(template string, args ...interface{})
Warnf(template string, args ...interface{})
Infof(template string, args ...interface{})
Debugf(template string, args ...interface{})
Panic(args ...interface{})
Fatal(args ...interface{})
Error(args ...interface{})
Warn(args ...interface{})
Info(args ...interface{})
Debug(args ...interface{})
PanicWithFields(fields map[string]interface{}, template string, args ...interface{})
FatalWithFields(fields map[string]interface{}, template string, args ...interface{})
ErrorWithFields(fields map[string]interface{}, template string, args ...interface{})
WarnWithFields(fields map[string]interface{}, template string, args ...interface{})
InfoWithFields(fields map[string]interface{}, template string, args ...interface{})
DebugWithFields(fields map[string]interface{}, template string, args ...interface{})
PanicContext(ctx context.Context, template string, args ...interface{})
FatalContext(ctx context.Context, template string, args ...interface{})
ErrorContext(ctx context.Context, template string, args ...interface{})
WarnContext(ctx context.Context, template string, args ...interface{})
InfoContext(ctx context.Context, template string, args ...interface{})
DebugContext(ctx context.Context, template string, args ...interface{})
PanicContextWithFields(ctx context.Context, fields map[string]interface{}, template string, args ...interface{})
FatalContextWithFields(ctx context.Context, fields map[string]interface{}, template string, args ...interface{})
ErrorContextWithFields(ctx context.Context, fields map[string]interface{}, template string, args ...interface{})
WarnContextWithFields(ctx context.Context, fields map[string]interface{}, template string, args ...interface{})
InfoContextWithFields(ctx context.Context, fields map[string]interface{}, template string, args ...interface{})
DebugContextWithFields(ctx context.Context, fields map[string]interface{}, template string, args ...interface{})
// AddFieldFunc filter deal the fields
AddFieldFunc(func(context.Context, map[string]interface{}))
GetZapLogger() *zap.Logger
GetZapSugaredLogger() *zap.SugaredLogger
}
LoggerInterface hide something you can implement new one
func Logger ¶
func Logger() LoggerInterface
Logger default log which output to console if you want to log to file you must New() and set something then call InitLogger()
func New ¶
func New() LoggerInterface
New can new a logger interface, you can config it by it's method
func SetCallerCallerSkip ¶
func SetCallerCallerSkip(skip int) LoggerInterface
func SetCallerShort ¶
func SetCallerShort(short bool) LoggerInterface
func SetFileRotate ¶
func SetFileRotate(maxSizeMB int, maxBackups int, maxAgeDay int) LoggerInterface
func SetIsOutputStdout ¶
func SetIsOutputStdout(isOutputStdout bool) LoggerInterface
func SetLevel ¶
func SetLevel(level Level) LoggerInterface
func SetName ¶
func SetName(name string) LoggerInterface
func SetOutputFile ¶
func SetOutputFile(logPath, fileName string) LoggerInterface
func SetOutputJson ¶
func SetOutputJson(json bool) LoggerInterface
Click to show internal directories.
Click to hide internal directories.