Skip to content

chizmeeple/go-maskedlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

My own wrapper round zerolog with the ability to mask "sensitive values"

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages