error_logging

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2022 License: MIT Imports: 3 Imported by: 0

README

Error handling

A simple package that helps me to manage errors in my go programs 😊

Documentation

Index

Constants

View Source
const (
	DATE_FORMAT string = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func Fatal added in v0.1.0

func Fatal(err error)

Does the same as LogError followed by os.Exit(1)

func Log added in v0.1.0

func Log(err error)

Checks if there are an error and log in the output that you specify

Types

type ErrorLogger added in v0.1.0

type ErrorLogger struct {
	// contains filtered or unexported fields
}

func NewLogger added in v0.1.0

func NewLogger(outFile *os.File, prefix string) ErrorLogger

Return a new error logger

func (*ErrorLogger) Fatal added in v0.1.0

func (self *ErrorLogger) Fatal(err error, message string)

Log the error and stop execution

func (*ErrorLogger) Fatalf added in v0.1.0

func (self *ErrorLogger) Fatalf(err error, message string, params ...interface{})

Log the formatted error and stop execution

func (*ErrorLogger) Log added in v0.1.0

func (self *ErrorLogger) Log(err error, message string)

log a message if the error is not nil

func (*ErrorLogger) Logf added in v0.1.0

func (self *ErrorLogger) Logf(err error, message string, params ...interface{})

log a formated message if the error is not nil

Jump to

Keyboard shortcuts

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