go-logrus-cloud is a hook for logrus logging framework which logs to Anexia CloudLog using the go cloudlog client.
go get -u github.com/anexia-it/go-logrus-cloudlog
Please also see the cloudlog client README
package main
import "github.com/anexia-it/go-logrus-cloudlog"
func main() {
// new cloudlog hook
hook := cloudlogrus.Must("index", "ca.pem", "cert.pem", "cert.key")
// add the new hook to logrus
log.AddHook(hook)
// use logrus
log.Info("my first cloudlog log message")
}
A custom log level can be set on the hook. This way you can for example log everything to the console and only Errors to cloudlog
hook.SetLevel(logrus.WarnLevel)
Custom cloudlog client and a custom map function can be provided. The map function controls the format of the logs within cloudlog
cloudlogrus.NewCustomHook(customClient, customMapFunction, logrus.ErrorLevel)