Categorygithub.com/chiselwright/go-maskedlog
repositorypackage
0.0.3
Repository: https://github.com/chiselwright/go-maskedlog.git
Documentation: pkg.go.dev

# README

go-maskedlog

goversion godoc Coverage reposize openissues GitHub pull requests Total alerts GitHub language count Maintenance GitHub last commit

A logger on built on top of zerolog that can mask sensitive values in the output.

Installation

go get github.com/chiselwright/go-maskedlog

Getting Started

package main

import (
	"fmt"

	"github.com/chiselwright/go-maskedlog"
)

func main() {
	logger := maskedlog.GetSingleton()

	val := "MySekritWurd"
	logger.AddSensitiveValue(val)

	logger.LogWarn(fmt.Sprintf("Failed to authenticate with password: %q", val))
}

will result in something similar to:

❯ go run .
{"level":"warn","time":"2021-01-06T21:25:19Z","message":"Failed to authenticate with password: \"MySexxxxWurd\""}

Twitter Follow