log
log copied to clipboard
#81: syslog handler
This is my first pass at implementing this handler. I wrote a quick little test script which seems to produce the behaviour I expect, but I welcome feedback on it.
package main
import (
"errors"
stdlog "log"
"github.com/apex/log"
"github.com/apex/log/handlers/syslog"
)
func main() {
h, err := syslog.New("", 0, "test")
if err != nil {
stdlog.Fatal(err)
}
log.SetHandler(h)
log.WithError(errors.New("errormsg")).WithFields(log.Fields{
"app": "myapp",
"env": "prod",
}).Warn("something went wrong\nunfortunately")
}
@tj: ok, I think that works alright, how's this look to you?