title: Passing context.Context to all relevant methods, golang
body: <p>I read all the decisions about dropping the ThreadLocal and I can relate.
  Seems like passing around the <code>request.Context()</code> that is of type <code>context.Context</code> gives the ability to manage scoped services.</p>
  
  <p>I am using <code>logrus</code> for logging and want to log a <code>requestId</code> that is a generate udid from a midlleware in <code>gin</code></p>
  
  <p>I know i can do something like this</p>
  
  <pre class="lang-golang prettyprint-override"><code>func Authentication(conf Configuration, logger ILogger, cache ICacheService) gin.HandlerFunc {
      return func(c *gin.Context) {
  
          logger := logrus.WithContext(c)
          c.Set("traceId", uuid.New().String())
          c.Next()
      }
  }
  
  </code></pre>
  
  <p>And the pass around the entry or even store the entry inside the context whatever works, but...
  I also have a <code>Redis</code> and <code>MongoDb</code> clients that are <code>singletons</code> and I am wrapping them with my own package to facilitate logging of any outgoing I\O requests.</p>
  
  <p>because they are singletones I cannot pas the <code>context.Context</code> to the constructor but ill have to pass it to every method like <code>GetKey</code> <code>SetKet</code> etc..</p>
  
  <p>any common patterns for using the context \ request id logging inside a Singleton service ? </p>