errs

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fatal

func Fatal(err error)

Fatal will log an error and exit if err is not nil.

func FatalF

func FatalF(format string, v ...interface{})

FatalF will log an error and exit if any argument passed to fatal is an error

func LogF

func LogF(format string, v ...interface{}) bool

LogF will log an error if any argument passed to format is an error

func Panic

func Panic(err error)

Panic will log an error and panic if err is not nil.

func PanicF

func PanicF(format string, v ...interface{})

PanicF will log an error and panic if any argument passed to format is an error

Types

type Handler

type Handler struct {
	Logger logger.OutputIface `validate:"required"` // Default logger
	// contains filtered or unexported fields
}

Handler error handling

func New

func New(eh *exit.Handler, lgr logger.OutputIface) *Handler

New return a *Handler object.

func (*Handler) Fatal

func (e *Handler) Fatal(err error)

Fatal will log an error and exit if err is not nil.

func (*Handler) FatalF

func (e *Handler) FatalF(format string, v ...interface{})

FatalF will log an error and exit if any argument passed to fatal is an error

func (*Handler) LogF

func (e *Handler) LogF(format string, v ...interface{}) bool

LogF will log an error if any argument passed to format is an error

func (*Handler) Panic

func (e *Handler) Panic(err error)

Panic will log an error and panic if err is not nil.

func (*Handler) PanicF

func (e *Handler) PanicF(format string, v ...interface{})

PanicF will log an error and panic if any argument passed to format is an error

type HandlerIface

type HandlerIface interface {
	// Panic will log an error and panic if err is not nil.
	Panic(err error)
	// PanicF will log an error and panic if any argument passed to format is an error
	PanicF(format string, v ...interface{})
	// LogF will log an error if any argument passed to format is an error
	LogF(format string, v ...interface{}) bool
	// Fatal will log an error and exit if err is not nil.
	Fatal(err error)
	// FatalF will log an error and exit if any argument passed to fatal is an error
	FatalF(format string, v ...interface{})
}

HandlerIface ...

Jump to

Keyboard shortcuts

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