error_logging

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 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

func Fatal(err error)

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

func Log

func Log(err error)

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

Types

type ErrorLogger

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

func NewLogger

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

Return a new error logger

func (*ErrorLogger) Fatal

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

Log the error and stop execution

func (*ErrorLogger) Fatalf

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

Log the formatted error and stop execution

func (*ErrorLogger) Log

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

log a message if the error is not nil

func (*ErrorLogger) Logf

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