Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func GetLogFromContext(ctx context.Context) *logger
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func InitFlags(flagset *flag.FlagSet)
- func InitLogers(logDirPath string, opt *RotateOption)
- func Sync() error
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- func WithFieldsContext(ctx context.Context, fields ...interface{}) context.Context
- func WithTraceID() string
- type Level
- type LevelEnableFunc
- type Logr
- type Option
- type OptionFunc
- type RotateOption
Constants ¶
View Source
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel = Level(zap.DebugLevel) // InfoLevel is the default Deflogging priority. InfoLevel = Level(zap.InfoLevel) // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel = Level(zap.WarnLevel) // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel = Level(zap.ErrorLevel) // FatalLevel logs a message, then calls os.Exit(1). FatalLevel = Level(zapcore.FatalLevel) )
Variables ¶
View Source
var (
Deflogging logger
)
Functions ¶
func GetLogFromContext ¶
func InitLogers ¶
func InitLogers(logDirPath string, opt *RotateOption)
func WithFieldsContext ¶
fields must be k/v format
func WithTraceID ¶
func WithTraceID() string
Types ¶
type LevelEnableFunc ¶
type Logr ¶
type Logr interface { Infof(template string, args ...interface{}) Info(args ...interface{}) Errorf(template string, args ...interface{}) Error(args ...interface{}) Fatalf(template string, args ...interface{}) Fatal(args ...interface{}) Warnf(template string, args ...interface{}) Warn(args ...interface{}) With(args ...interface{}) Logr Debugf(template string, args ...interface{}) Debug(args ...interface{}) Enable() bool }
type OptionFunc ¶
type OptionFunc func(option *RotateOption)
func WithLogSaveDay ¶
func WithLogSaveDay(day int) OptionFunc
type RotateOption ¶
func NewDefaultRotate ¶
func NewDefaultRotate(opts ...OptionFunc) *RotateOption
Click to show internal directories.
Click to hide internal directories.