Adding support for logging & verbose logging. Consolidation of error handling. Integration of jWalterWeatherman library. Fixed #137

This commit is contained in:
spf13 2014-03-31 13:23:34 -04:00
parent 2fa3761ec9
commit e50b9d8ac1
15 changed files with 140 additions and 111 deletions

View file

@ -1,22 +1,24 @@
package utils
import (
"log"
"os"
jww "github.com/spf13/jwalterweatherman"
)
func CheckErr(err error, s ...string) {
if err != nil {
for _, message := range s {
log.Fatalf(message)
jww.ERROR.Println(message)
}
log.Fatalf("Fatal Error: %v", err)
}
}
func StopOnErr(err error, s ...string) {
if err != nil {
CheckErr(err, s...)
for _, message := range s {
jww.CRITICAL.Println(message)
}
os.Exit(-1)
}
}