Closed saward closed 8 years ago
Indeed. As it's a breaking change in the API, I need to create a new tag for gopkg.in for a v2. I will merge your branch this week. Thanks!
Sounds good! While you're considering breaking changes, I'd suggest that you change the hook to return an error if it can't connect, rather than try to log the error itself and continue on.
E.g.:
// NewGraylogHook creates a hook to be added to an instance of logger.
func NewGraylogHook(addr string, extra map[string]interface{}) (*GraylogHook, error) {
g, err := gelf.NewWriter(addr)
if err != nil {
return nil, err
}
hook := &GraylogHook{
Extra: extra,
gelfLogger: g,
synchronous: true,
}
return hook, nil
}
This is what I have done in the master branch of my fork.
According to the documentation, 'facility' is deprecated and should be included as an additional field instead if wanted:
http://docs.graylog.org/en/2.0/pages/gelf.html