logging

package
v0.0.0-...-a65319e Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotFoundError     = "NotFoundError"
	InternalError     = "InternalError"
	IllegalParamError = "IllegalParamError"
	ParseError        = "ParseError"
	BusinessError     = "BusinessError"
	ForbiddenError    = "ForbiddenError"
)
View Source
const LoggerFlag = LoggerType("api-logger-context")

Variables

This section is empty.

Functions

func GetErrorDetails

func GetErrorDetails(err error) string

func GetErrorType

func GetErrorType(err error) string

func LogErrorFromCtx

func LogErrorFromCtx(ctx context.Context, err error)

func LoggerFromContext

func LoggerFromContext(ctx context.Context) (*zap.SugaredLogger, bool)

func NewError

func NewError(message string, err error, typeError string, meta map[string]string, operations ...string) error

func NewLogger

func NewLogger() (*zap.Logger, error)

func NewValidationError

func NewValidationError(validationError error, uniTranslator *ut.UniversalTranslator) error

func WithMeta

func WithMeta(err error, key, value string) error

func WithOperation

func WithOperation(err error, operation string) error

Types

type CustomError

type CustomError struct {
	ID         uuid.UUID         `json:"id"`
	Message    string            `json:"message"`
	Detail     string            `json:"detail"`
	Operations []string          `json:"-"`
	Type       string            `json:"type"`
	Timestamp  string            `json:"timestamp"`
	Meta       map[string]string `json:"-"`
}

func Unwrap

func Unwrap(err error) CustomError

func (CustomError) Error

func (customError CustomError) Error() string

type LoggerType

type LoggerType string

Jump to

Keyboard shortcuts

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