An open API service indexing awesome lists of open source software.

https://github.com/fs02/logrus-filtered-formatter

Logrus JSON Formatter with filterable fields
https://github.com/fs02/logrus-filtered-formatter

Last synced: over 1 year ago
JSON representation

Logrus JSON Formatter with filterable fields

Awesome Lists containing this project

README

          

# Logrus Filtered Formatter
Use this formatter to log json with filtered fields

## Usage
```
package main

import (
"github.com/Fs02/logrus-filtered-formatter"
"github.com/sirupsen/logrus"
)

func main() {
log := logrus.New()
fields := []string{
"password",
"email",
}
log.Formatter = filtered.New(fields, &logrus.JSONFormatter{})

log.WithFields(logrus.Fields{
"password": "asdfasdf",
"email": "johndoe@gmail.com",
"name": "john doe",
}).Info("new user created")
}
```
Output:
```
{"email":[FILTERED],"level":"info","msg":"new user created","name":"john doe","password":[FILTERED],"time":"2017-10-05T16:05:29+07:00"}
```