Skip to content
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

Add additional hlog logging handlers #607

Merged
merged 7 commits into from
Nov 8, 2023
Merged

Add additional hlog logging handlers #607

merged 7 commits into from
Nov 8, 2023

Conversation

mitar
Copy link
Contributor

@mitar mitar commented Oct 21, 2023

  • HTTPVersionHandler: Similar to ProtoHandler, just without HTTP/ prefix. In practice, there is always HTTP/ prefix, so we can drop that (if it exists, which it does) to have more compact logs.
  • RemoteAddrHandlerWithoutPort: Similar to RemoteAddrHandler, but do you really care about a remote port? Remote port makes it hard to aggregate logs based on remote IP.
  • HostHandlerWithoutPort: Is similar, generally you do not care on which local port you run stuff.
  • EtagHandler: Logs response header, Etag, can help with debugging which version of content user got.
  • ResponseHeaderHandler: Similar to CustomHeaderHandler, but for response headers. If you do canonical log lines, you probably have middleware which logs it after everything is handled, so this handler should be earlier in the middleware stack.

@mitar mitar force-pushed the handlers branch 4 times, most recently from 5647565 to c79fa09 Compare October 23, 2023 12:06
@rs
Copy link
Owner

rs commented Oct 28, 2023

  • RemoteAddrHandlerWithoutPort would probably be better named RemoteIPHandler
  • HostHandlerWithoutPort could just be a HostHandler with an optional (variadic) bool parameter trimPort.

@mitar
Copy link
Contributor Author

mitar commented Oct 29, 2023

Renamed.

@rs rs merged commit bb14b8b into rs:master Nov 8, 2023
5 checks passed
madkins23 pushed a commit to madkins23/zerolog that referenced this pull request Mar 2, 2024
* Add HTTPVersionHandler.

* Add RemoteIPHandler.

* Add trimPort to HostHandler.

* Add EtagHandler.

* Add ResponseHeaderHandler.

* Add TestGetHost.

* Call AccessHandler's f also on panic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants