Simple configurable logging tool
Go to file
Dan Ballard fc6d9a372e add color support: levels are now printed with a corresponding color 2020-06-18 17:54:38 -07: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 import libricochet-go log as stand alone repo 2020-02-05 18:36:17 -05:00
go.mod fix go/mod name 2020-02-06 14:31:18 -05:00
log.go add color support: levels are now printed with a corresponding color 2020-06-18 17:54:38 -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.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)
	}
}