feat(log): add --log-user-agent option to log User-Agent header - #750
Open
TheBigUserOne wants to merge 1 commit into
Open
TheBigUserOne wants to merge 1 commit into
TheBigUserOne wants to merge 1 commit into
Conversation
Changed Files
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #576.
Adds a
--log-user-agentCLI flag (env:SERVER_LOG_USER_AGENT, TOML:log_user_agent) to include theUser-Agentrequest header in access logs.Changes
Follows the exact same pattern as
--log-remote-address,--log-x-real-ip, and--log-forwarded-for:log_user_agent: boolfield toRequestHandlerOptsUser-Agentheader inlog_addr::pre_process()when enabledtracing::info!span alongside other address fieldsFiles changed
src/handler.rs— addedlog_user_agentfield toRequestHandlerOptssrc/log_addr.rs— extract and log User-Agent headersrc/settings/cli.rs— added--log-user-agentCLI optionsrc/settings/file.rs— added TOML config optionsrc/settings/mod.rs— wired config file overridesrc/server/opts.rs— wired to handler optssrc/testing.rs— updated test helperUsage
static-web-server --log-user-agent # or SERVER_LOG_USER_AGENT=true static-web-serverTOML: