You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Using the current router mux exported by the server package results in endpoints always logging accesses in a specific format. When running a Rosetta server implementation backed by some other pre-existing node server that logs in a different format, logs become slightly harder to read.
Additionally, we might want to offer different forms of logging or offer the option to disable logging altogether to users.
Describe the solution you'd like
Make middlewares (including the currently existing Logger) configurable when calling server.NewRouter.
Describe alternatives you've considered
Another alternative would be disabling logging altogether in the library and having that be a responsibility of users.
The text was updated successfully, but these errors were encountered:
After taking a second look at the routers, I believe the easiest solution would be to simply drop the existing Cors and Logger middleware from the NewRouter() call and leave it up to the caller to install any middleware they desire. They can be offered as package-level clients and we could add an example on how to use them.
If we really want to offer the ability to add a per-route middleware (such as the current router) the simplest change would be to switch the signature of NewRouter to something like:
@matheusd Thanks for digging into this! I like the idea of leaving it up to the caller to install any middleware they desire. I think the "logger per route" strategy was the default for the codegen but I don't feel any particular allegiance to it. You could easily accomplish something similar in a custom logger by inspecting the http.Request on the HandlerFunc.
I think having some simple default logger that can be added still makes sense but agree the current one is AWFUL!
Is your feature request related to a problem? Please describe.
Using the current router mux exported by the server package results in endpoints always logging accesses in a specific format. When running a Rosetta server implementation backed by some other pre-existing node server that logs in a different format, logs become slightly harder to read.
Additionally, we might want to offer different forms of logging or offer the option to disable logging altogether to users.
Describe the solution you'd like
Make middlewares (including the currently existing Logger) configurable when calling
server.NewRouter
.Describe alternatives you've considered
Another alternative would be disabling logging altogether in the library and having that be a responsibility of users.
The text was updated successfully, but these errors were encountered: