logger

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package logger logger used by cli

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Block

func Block(ctx context.Context, title string, content string)

Block print debug content with title

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

func WithLogger(ctx context.Context, logger *zap.SugaredLogger) context.Context

WithLogger set a logger instance into a context

Types

type OutputWriter

type OutputWriter interface {
	Output(s string) error
}

OutputWriter describe an output writer

func NewOutput

func NewOutput(writer io.Writer) OutputWriter

NewOutput construct an OutputWriter

Jump to

Keyboard shortcuts

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