DEV Community

Discussion on: Interfaces in Go

Collapse
 
chuck_ha profile image
Chuck Ha

Sometimes loggers are fine global, but sometimes, particularly if you don't want to be tied to one logging implementation, it's better to make the dependency explicit because your code can evolve much more easily as software trends start to mature.

I hear you though, I use a global logger when it makes sense and use dependency injection when it makes sense. Refactoring like this is all about situational awareness. There is no one size fits all solution.