move config parse error logging into function to ensure new lines and don't parse config for help

This commit is contained in:
Willy Kloucek
2022-08-18 15:27:28 +02:00
committed by Willy Kloucek
parent d1f0dbc4c9
commit e58eaabdeb
92 changed files with 241 additions and 526 deletions
+30
View File
@@ -0,0 +1,30 @@
package configlog
import (
"fmt"
"os"
)
// LogError logs the error
func LogError(err error) {
if err != nil {
fmt.Printf("%v\n", err)
}
}
// LogError logs the error and returns it unchanged
func LogReturnError(err error) error {
if err != nil {
fmt.Printf("%v\n", err)
}
return err
}
// LogReturnFatal logs the error and calls os.Exit(1) and returns nil if no error is passed
func LogReturnFatal(err error) error {
if err != nil {
fmt.Printf("%v\n", err)
os.Exit(1)
}
return nil
}