This is less sophisticated than the default logrus one, but it is
much easier to read the server output. Primarily with JSON fields
and multi-line strings. They are decoded and prettified.
Signed-off-by: Patrick East <east.patrick@gmail.com>
This changes how OPA logs API requests and responses.
Before:
- OPA would not log at level.Info
- OPA would log request header and body and response header (but not
body) at level.Debug.
After:
- OPA logs request and response headers at level.Info
- OPA includes request and response body at level.Debug.
Use httputil.DumpRequest as this is much cleaner than previous approach
and handles all requests (instead of just /data). With new approach we
can get rid of getInputParam and related tests.
Also, move slack link around.
Fixes#281
Callers currently provide globals as query parameters. Because the query
params are often JSON values, they need to be escaped. This results in the
access logs being very noisy.
This change removes the "global" query params from the access logs at
V(2) and pretty prints them on a separate line at V(3).
Wrap the router so to capture response latency and implement an interceptor
that captures status codes and number of bytes written. Log the information
once the inner route completes.