paramlogger

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2023 License: MIT, MIT Imports: 6 Imported by: 140

README

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)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ParameterExclusionList = []string{
	"Password",
	"PasswordConfirmation",
	"CreditCard",
	"CVC",
}

ParameterExclusionList is the list of parameter names that will be filtered from the application logs (see maskSecrets). Important: this list will be used in case insensitive.

Functions

func ParameterLogger

func ParameterLogger(next buffalo.Handler) buffalo.Handler

ParameterLogger logs form and parameter values to the loggers

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL