-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
caddyhttp: Support multiple logger names per host #6088
Conversation
f73169a
to
b833712
Compare
We can do custom unmarshaling by implementing the |
I guess so. 🤔 Most of the time that approach feels wrong but in this case it can be transparent so it's probably fine. |
ef14c0e
to
3ca519b
Compare
Thanks for the idea @mohammed90! Much better I think. |
The user tried it out and confirmed it resolves their usecase: https://caddy.community/t/config-cleanup-for-logging-blocking-and-a-signalr-issue/22643/12 |
992b925
to
20b3395
Compare
Great 😃 I have to update the nginx-adapter after this PR |
20b3395
to
c514026
Compare
c514026
to
3a139a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks quite complicated to me 🙈 but if it works and is useful for real world use cases, I guess that's how it goes (my fault for the logging design). Thank you for the tricky patch!!
3a139a3
to
227d5de
Compare
227d5de
to
29c55ab
Compare
Context: https://caddy.community/t/config-cleanup-for-logging-blocking-and-a-signalr-issue/22643
I realized that there's currently no good way to point a specific hostname to write to more than one logger at once, because
logger_names
is a simplemap[string]string
(so only one value per key).To solve this,
I'm deprecatingI'm changinglogger_names
and adding a newlogger_mapping
(which Caddyfile immediately uses)logger_names
to be amap[string]StringArray
which is a type which accepts either a JSON string or array (where a string gets turned into a one-element string slice). Then, I reworked the logging code in the server to loop over the list of wrapped loggers.I'm not 100% convinced about theResolved by doing custom JSON unmarshaling.logger_mapping
name... I'd rather reuselogger_names
, but obviously we can't do that, it would be a breaking change. Any better naming ideas?