-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Handlers should be able to add field to server log output for debugging and extending functionality purpose.
Currently when a http.handler can only emit log using its own logger provisioned when creating an instance of the module. A module can attach some context information to the request handled.
Currently caddy tries to determine user_id from basicauth. However if it's not configured it will be empty and people maybe confused by its presence. (Commonly, most usage of caddy is just reverse proxy and file server.). Trying from the entry ServeHttp function is simply too much to maintain for every handler module that caddy is shipped with.
A recent pr will also add a new field to determine client_ip and it's also available as a variable.
Allow http.handlers to add custom fields to log can help generate logs that are easier to analyse.