modulepackage
1.0.2
Repository: https://github.com/gobuffalo/mw-paramlogger.git
Documentation: pkg.go.dev
# README
mw-paramlogger
NOTE: v1.0.2 will be the last version of this module and it will be deprecated. Use https://github.com/gobuffalo/middleware instead.
Requirements
- Go 1.16+ but 1.17 and 1.18 are officially supported
- Go Modules
Installation
$ go get github.com/gobuffalo/mw-paramlogger@latest
Usage
Paramlogger is used by applications generated by the Buffalo CLI. You can see its usage in the actions/app.go
file of a generated application:
...
// Log request parameters (filters apply).
app.Use(paramlogger.ParameterLogger)
...
(Use case) Filtering some parameters
In some cases there is the need to avoid logging certain parameters for security reasons. The Paramlogger middleware allows to exclude those parameters by specifying those in the ParameterExclusionList
before using the ParamegerLogger middleware in the app.
paramlogger.ParameterExclusionList = append(ParameterExclusionList, "secure", "secure_parameter")
app.Use(paramlogger.ParameterLogger)
# Functions
ParameterLogger logs form and parameter values to the loggers.
# Variables
ParameterExclusionList is the list of parameter names that will be filtered from the application logs (see maskSecrets).