title: How to work with concurrent logs in golang?
body: <p>I've searched for it and only found <a href="https://stackoverflow.com/questions/18361750/correct-approach-to-global-logging-in-golang">here</a> and <a href="https://stackoverflow.com/questions/19115273/looking-for-a-call-or-thread-id-to-use-for-logging">here</a>, but it does not solve my problem.</p>
  
  <p>How can I, using a standard way, identify the log separating the concurrent logs like JAVA does with thread ID? Because if I have a concurrent method then the logs will be printed mixed at the output, so I think that the LOGGER needs to have a way of identifying each request "thread"</p>
  
  <p>Ex:</p>
  
  <pre><code>package main
  
  import "log"
  
  func main() {
  
      /* simulating 10000 users requests  */
      for i:=1; i &lt; 10000; i++ {
          go getHello(i)
      }
  }
  
  func getHello(d int){
      log.Printf("m=getHello, i=%d,begin", d)
      log.Println("m=getHello, processing the hello message")
      log.Printf("m=getHello, i=%d, end", d)
  }
  </code></pre>
  
  <p>output</p>
  
  <pre><code>2016/07/29 15:59:46 m=getHello, i=1017,begin
  2016/07/29 15:59:46 m=getHello, processing the hello message
  2016/07/29 15:59:46 m=getHello, i=1017, end
  2016/07/29 15:59:46 m=getHello, processing the hello message
  2016/07/29 15:59:46 m=getHello, i=1038, end
  2016/07/29 15:59:46 m=getHello, i=311,begin
  2016/07/29 15:59:46 m=getHello, processing the hello message
  2016/07/29 15:59:46 m=getHello, i=311, end
  2016/07/29 15:59:46 m=getHello, i=1023,begin
  </code></pre>
  
  <p>As you can see, without using an int flag, it is impossible to know which request logged a message. In Java and C for example you can use thread id for this purpose.</p>
  
  <p>How to achieve this in Golang? Thanks.</p>