Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.34 KB

README.md

File metadata and controls

38 lines (27 loc) · 1.34 KB

mw-paramlogger

Standard Test Go Reference

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)