Documentation ¶
Index ¶
- Variables
- func CheckErr(msg string, err error, fields ...zapcore.Field)
- func CheckErrCtx(ctx context.Context, msg string, err error, fields ...zapcore.Field)
- func SafeClose(c io.Closer, msg string, fields ...zapcore.Field)
- func SafeCloseCtx(ctx context.Context, c io.Closer, msg string, fields ...zapcore.Field)
- func SetLoggerFactory(instance LoggerFactory)
- func Setup(ctx context.Context, opts *Options)
- type Logger
- type LoggerFactory
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = &Options{ Debug: false, LogLevel: "info", AppName: "changeme", AppID: "changeme", Version: "0.0.1", Revision: "123456789", SentryDSN: "", }
DefaultOptions defines default logger options.
Functions ¶
func CheckErrCtx ¶
CheckErrCtx handles error correctly.
func SafeCloseCtx ¶
SafeCloseCtx handles the closer error.
func SetLoggerFactory ¶
func SetLoggerFactory(instance LoggerFactory)
SetLoggerFactory defines the default package logger.
Types ¶
type Logger ¶
type Logger interface { Debug(msg string, fields ...zapcore.Field) Info(msg string, fields ...zapcore.Field) Warn(msg string, fields ...zapcore.Field) Error(msg string, fields ...zapcore.Field) Fatal(msg string, fields ...zapcore.Field) With(fields ...zapcore.Field) Logger }
Logger is a simplified abstraction of the zap.Logger.
type LoggerFactory ¶
type LoggerFactory interface { Name() string Bg() Logger For(context.Context) Logger With(...zapcore.Field) LoggerFactory }
LoggerFactory defines logger factory contract.
func NewFactory ¶
func NewFactory(logger *zap.Logger) LoggerFactory
NewFactory creates a new Factory.
Click to show internal directories.
Click to hide internal directories.