Skip to content
Snippets Groups Projects
Commit 01d34904 authored by Christel Loftus's avatar Christel Loftus
Browse files

error message logs to support formatting

parent 98b1a44e
Branches
Tags
1 merge request!54Error msg to support formatting
...@@ -242,11 +242,13 @@ func ErrorWithFields(fields map[string]interface{}, err error) { ...@@ -242,11 +242,13 @@ func ErrorWithFields(fields map[string]interface{}, err error) {
} }
} }
func ErrorWithMsg(message string, err error) { func ErrorWithMsg(format string, err error, a ...interface{}) {
if disableLogging { if disableLogging {
return return
} }
message := SanitiseLogs(fmt.Sprintf(format, a...))
if err == nil { if err == nil {
err = errors.Error(message) err = errors.Error(message)
} }
...@@ -255,11 +257,13 @@ func ErrorWithMsg(message string, err error) { ...@@ -255,11 +257,13 @@ func ErrorWithMsg(message string, err error) {
}, err) }, err)
} }
func ErrorMsg(message string) { func ErrorMsg(format string, a ...interface{}) {
if disableLogging { if disableLogging {
return return
} }
message := SanitiseLogs(fmt.Sprintf(format, a...))
ErrorWithMsg(message, nil) ErrorWithMsg(message, nil)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment