common

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2021 License: 0BSD Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log = &logrus.Logger{
	Out:       os.Stdout,
	Formatter: new(logrus.TextFormatter),
	Hooks:     make(logrus.LevelHooks),
	Level:     logrus.InfoLevel,
}

Info:

Log.Info("Info")

Debug:

Log.Debug("Debug")

Error:

Log.Error("Error")

Warn:

Log.Warn("Warn")

Functions

func CheckErr

func CheckErr(err error, trace string) bool

This function checks for an error. If the error isn't nil it return true and print error otherwise false.

err := errors.New("Test Error")
if common.CheckErr(err, "example error") {
	return
}

fmt.Println("No error was found!")

func Uptime

func Uptime(start time.Time) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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