You may or may not agree with this but Peter makes the strong point of making all dependencies explicit (skip to around 31:40 if you don't want to watch it all): https://www.infoq.com/presentations/go-patterns
Even "hiding" the logger in Context is questionable many times. And yes, it may make your API "ugly" or force you to update a bunch of function signatures, but it's a better alternative to obfuscating behavior in the code by using globals, using thread local storage or hiding things in Context when they don't belong there. On Thursday, December 15, 2016 at 5:24:30 AM UTC-8, DM wrote: > > Actually that is my problem changing all functions to pass on the context. > > On 15-Dec-2016 6:51 pm, "Gulácsi Tamás" <tgula...@gmail.com <javascript:>> > wrote: > >> Debraj Manna <subhara...@gmail.com <javascript:>> ezt írta (időpont: >> 2016. dec. 15., Cs, 14:12): >> >>> If I get you correctly I still have to pass the Context (with logger >>> attached) to all the functions where I wish to do the logging. >>> >>> If my understanding is not correct then can you please give me a small >>> example? >>> >>> No, you're right: you have to pass around the Context, or the logger. >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.