gemnasium / logrus-graylog-hook

Graylog hook for logrus
MIT License
87 stars 63 forks source link

update logrus add hook call #22

Closed brandonblock closed 7 years ago

brandonblock commented 7 years ago

Just notice that the readme uses an older logrus function

gravis commented 7 years ago

Hi Brandon. Actually, log.Hooks.Add is not deprecated :) addHook will only work if the import is named log (which is the case here), because it's a package function. To add a hook to a logger (which is not necessary the std one), Hooks.Add must be used. In other words, the current version is more portable, and will work either with a named import or a custom logger. Makes sense? Thanks :)

refs:

brandonblock commented 7 years ago

Yup, makes sense... except the example as-is won't work, right? There's no package level function name "Hooks." I guess what I'm saying is that the example doesn't build or run.

gravis commented 7 years ago

Ho, good catch... Sorry, you're absolutely right :)

gravis commented 7 years ago

Thanks !

brandonblock commented 7 years ago

Thanks for maintaining this project!