Top 2.1% dependent packages on proxy.golang.org
Top 4.8% dependent repos on proxy.golang.org
Top 8.8% forks on proxy.golang.org
proxy.golang.org : github.com/gilcrest/httplog
Package httplog logs http requests and responses. It’s highly configurable, e.g. in production, log all response and requests, but don’t log the body or headers, in your dev environment log everything and so on. httplog also has different ways to log depending on your preference — structured logging via JSON, relational database logging or just plain standard library logging. httplog has logic to turn on/off logging based on options you can either pass in to the middleware handler or from a JSON input file included with the library. httplog offers three middleware choices, each of which adhere to fairly common middleware patterns: a simple HandlerFunc (`LogHandlerFunc`), a function (`LogHandler`) that takes a handler and returns a handler (aka Constructor) (`func (http.Handler) http.Handler`) often used with alice (https://github.com/justinas/alice) and finally a function (`LogAdapter`) that returns an Adapter type. An `httplog.Adapt` function and `httplog.Adapter` type are provided. Beyond logging request and response elements, httplog creates a unique id for each incoming request (using xid (https://github.com/rs/xid)) and sets it (and a few other key request elements) into the request context. You can access these context items using provided helper functions, including a function that returns an audit struct you can add to response payloads that provide clients with helpful information for support. !!!!WARNING!!!! - This package works, but is something I wrote a long time ago and really needs to be updated. I logged Issue #8 to some day address this.
Registry
-
Source
- Documentation
- JSON
- codemeta.json
purl: pkg:golang/github.com/gilcrest/httplog
Keywords:
golang
, http-logger
, middleware
License: MIT
Latest release: about 4 years ago
First release: about 7 years ago
Namespace: github.com/gilcrest
Dependent packages: 7
Dependent repositories: 1
Stars: 12 on GitHub
Forks: 4 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 23 days ago