Documentation ¶
Overview ¶
Package logger logger used by cli
Index ¶
- func Block(ctx context.Context, title string, content string)
- func EmojiLevelEncoder(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
- func Errors(ctx context.Context, errs utilerrors.Aggregate)
- func GetLogger(ctx context.Context) (logger *zap.SugaredLogger)
- func NewLogger(writer zapcore.WriteSyncer, level zapcore.LevelEnabler, opts ...zap.Option) *zap.SugaredLogger
- func NewLoggerFromContext(ctx context.Context) (logger *zap.SugaredLogger)
- func ResultErrors(ctx context.Context, errs utilerrors.Aggregate, successMsg, errorMsg string) (err error)
- func WithLogger(ctx context.Context, logger *zap.SugaredLogger) context.Context
- type OutputWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmojiLevelEncoder ¶
func EmojiLevelEncoder(l zapcore.Level, enc zapcore.PrimitiveArrayEncoder)
EmojiLevelEncoder prints an emoji instead of the log level ❌ for Panic, Error and Fatal levels 🐛 for Debug ❗️ for Warning 📢 for Info and everything else
func Errors ¶
func Errors(ctx context.Context, errs utilerrors.Aggregate)
Errors print the result of validate
func GetLogger ¶
func GetLogger(ctx context.Context) (logger *zap.SugaredLogger)
GetLogger get a logger instance form a context
func NewLogger ¶
func NewLogger(writer zapcore.WriteSyncer, level zapcore.LevelEnabler, opts ...zap.Option) *zap.SugaredLogger
NewLogger construct a logger
func NewLoggerFromContext ¶
func NewLoggerFromContext(ctx context.Context) (logger *zap.SugaredLogger)
NewLoggerFromContext similar to `GetLogger`, but return a default logger if there is no logger instance in the context
func ResultErrors ¶
func ResultErrors(ctx context.Context, errs utilerrors.Aggregate, successMsg, errorMsg string) (err error)
ResultErrors print the result of validate
func WithLogger ¶
WithLogger set a logger instance into a context
Types ¶
type OutputWriter ¶
OutputWriter describe an output writer
Click to show internal directories.
Click to hide internal directories.