Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a vararg interface{} parameter for xrecovery.WithExtraFields #10

Closed
Aoi-hosizora opened this issue Nov 5, 2020 · 2 comments
Closed
Labels
enhancement New feature or request

Comments

@Aoi-hosizora
Copy link
Owner

Aoi-hosizora commented Nov 5, 2020

https://github.com/Aoi-hosizora/ahlib-web/blob/8c048957fb02c28892672369e7f02f54cc8cc84c/xrecovery/logger.go#L18-L22

if err := recover(); err != nil {
	rid := c.Writer.Header().Get("X-Request-Id")
	r := result.Error(exception.ServerRecoveryError)
	r.Error = xgin.BuildErrorDto(err, c, skip, true, "request_id", rid)
	xrecovery.WithLogrus(logger, err, xrecovery.WithExtraString(rid), xrecovery.WithExtraFields(map[string]interface{}{"requestID": rid}))
	r.JSON(c)
}
@Aoi-hosizora Aoi-hosizora added the enhancement New feature or request label Nov 5, 2020
@Aoi-hosizora
Copy link
Owner Author

Aoi-hosizora commented Nov 5, 2020

Also a function used for converting from []interface{} to map[string]interface{} can be added to ahlib.xslice. (Done)

@Aoi-hosizora
Copy link
Owner Author

Done in 8a863de.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant