diff --git a/exceptionless/exceptionless.go b/exceptionless/exceptionless.go index 59569b6..32885af 100644 --- a/exceptionless/exceptionless.go +++ b/exceptionless/exceptionless.go @@ -15,6 +15,7 @@ var config map[string]interface{} = nil type Config struct { ApiKey string ServerURL string + ProgramName string UpdateSettingsWhenIdleInterval int32 } @@ -134,13 +135,15 @@ func AddData(event Event, data map[string]interface{}) Event { return event } -func SubmitAppError(source string, reqid *string, err error) string { +func SubmitAppError(funcName string, proc string, reqid *string, err error) string { referenceID := uuid.Must(uuid.NewUUID()).String() + if reqid != nil { referenceID = *reqid } errorMap := map[string]interface{}{} + errorMap["function"] = funcName errorMap["type"] = "error" errorMap["message"] = err.Error() errorMap["date"] = time.Now().Format(time.RFC3339) @@ -148,10 +151,10 @@ func SubmitAppError(source string, reqid *string, err error) string { data["@simple_error"] = errorMap var event = Event{ EventType: "error", - Message: err.Error(), + Message: proc, Data: data, ReferenceID: referenceID, - Source: source, + Source: conf.ProgramName, } json, err := json.Marshal(event) if err != nil {