Simple configurable logging tool
Go to file
Sarah Jamie Lewis 48705b04d3 Merge pull request 'adding locks for thread safety' (#4) from threadSafe into master
Reviewed-on: #4
2021-09-09 21:48:00 +00:00
.gitignore add color support: levels are now printed with a corresponding color 2020-06-18 17:54:38 -07:00
LICENSE import libricochet-go log as stand alone repo 2020-02-05 18:36:17 -05:00
README.md add privacy filter 2020-12-04 23:10:16 -08:00
go.mod fix go/mod name 2020-02-06 14:31:18 -05:00
log.go adding locks for thread safety 2021-09-09 14:38:14 -07:00

README.md

log

A simple log primative Open Privacy uses

Examples:

log.AddEverythingFromPattern("connectivity")
log.SetLevel(log.LevelDebug)
log.ExcludeFromPattern("connection/connection")
log.ExcludeFromPattern("outbound/3dhauthchannel")
log.AddPrivacyFilter(func(s string) bool {
    return len(s) == 56
})
log.SetPrivacyFilterReplace(true)

log.Debugf("Creating the thing with param %v\n", param)
log.Infoln("Doing thing X")
log.Warnf("This might be bad: %v\n", err)
log.Errorf("Failed to do thing: %v\n", err)

Making log go to a file

if runtime.GOOS == "windows" {
	filelogger, err := log.NewFile(log.LevelInfo, "cwtch_log.txt")
	if err == nil {
		log.SetStd(filelogger)
	}
}