title: looking for a call or thread id to use for logging
body: <p>I am reworking the logging of our little web application written in golang. Due to external requirements logging has been isolated in one place so we can potentially switch in a <strong>logging server</strong> later on. (Not my idea - I promise....) Nevertheless we are now able to log the common things like date/time, line number, user and the message mostly using parts of the standard library and a user/session struct we are passing around. </p>
  
  <p>But - and here comes the question - in lower level methods it is a waste to pass in the session just to get to the user name for the sake of logging. So I would like to find something else to use to find one specific request in the log files. I am sure there are something obvious I haven't thought of. </p>
  
  <p>Ideas so far:</p>
  
  <ul>
  <li>Java logging frameworks can print out the thread id and that would be good enough in this case also. Just that it is called something else in golang?</li>
  <li>make the user/session struct thing accesible globally somehow. (Still need to pass the session id around unless there are a thread to use as lookup key. Back to idea number 1.)</li>
  <li>give up and pass the user/session struct around anyway.</li>
  <li>don't log errors on the lowest level but only when the user/session struct is available. The line number won't be that good though.</li>
  </ul>
  
  <p>We are using parts of gorilla for web things and apart from that mostly the standard library.</p>
  
  <p>Suggestions and ideas about this?</p>