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
[Proposal] Custom parser in recover middleware #796
Comments
I think a better approach is to just let developers use their own recovering strategy. |
How is this relevant to this proposal? |
My understanding is that you want to alter the logic of the Your proposal adds complexity to the current Apologies if I misinterpreted your proposal. |
Yes, you are right. The main reason behind the proposal to have the same functionality as it was, but make it modular so if anyone wants to have an other format for the printed output they could have make it. If everybody write their own middleware then what's the point of having open source code? I think people develop open-source projects to solve a common problem which suits as many people as possible. On the other hand there will be hundreds of the copies of the same code plus a few lines. I agree if you are not accepting this proposal for certain reason, but I think this is the reason why people writing open-source code, because it can be altered to serve more people needs by being backward compatible. |
The parser of the recover middleware is hard coded. The only issue with this, that most of the log aggregator solutions can't handle that kind of format. As I checked the code
prettyStack
is the actual implementation of the parser inside the recover.go.Proposal
What do you think about to create an interface with a method:
Parse(debugStack []byte, rvr interface{}) ([]byte, error)
, and a singleton pattern likevar stackParser {INTERFACENAME} = prettyStack{}
. After we can use thestackParser
in thePrintPrettyStack
. Also adding a function toSetStackParser({INTERFACENAME})
.What do you think about? If you like it, I can implement it with a few tests.
The proposal looks like this: PumpkinSeed#1
The text was updated successfully, but these errors were encountered: