title: Golang package - go-logging
body: <p>I am trying to use the golang package: <a href="https://github.com/op/go-logging" rel="nofollow">https://github.com/op/go-logging</a></p>
  
  <p>I have set it up following the instructions and it works.</p>
  
  <pre><code>var log = logging.MustGetLogger("example")
  
  var format = logging.MustStringFormatter(
      "%{color}%{time:15:04:05.000} %{shortfunc} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}",
  )
  
  func main() {
  
      backend2 := logging.NewLogBackend(os.Stderr, "", 0)
      backend2Formatter := logging.NewBackendFormatter(backend2, format)
      logging.SetBackend(backend2Formatter)
  
      log.Info("info")
      log.Notice("notice")
      log.Warning("warning")
      log.Error("err")
      log.Critical("crit")
  
      r.POST("/v1.0/route-one/", controllers.RouteOne)
      r.GET("/v1.0/route-two", controllers.RouteTwo)
  
      r.Run(":8080")
  
  }
  </code></pre>
  
  <p>However I want to create logs from any of the controllers from within my App, how would I create logs from within a controller after the initial declaration in main.go without having to re-write the format etc? Ideally id like to be able to just write <code>log.Error("err")</code> anywhere to create a log.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Created a package:</p>
  
  <pre><code>package log
  
  import (
      "github.com/op/go-logging"
      "os"
  )
  
  var Log = logging.MustGetLogger("example")
  
  var format = logging.MustStringFormatter(
      "%{color}%{time:15:04:05.000} %{shortfunc} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}",
  )
  
  func init() {
  
      backend2 := logging.NewLogBackend(os.Stderr, "", 0)
      backend2Formatter := logging.NewBackendFormatter(backend2, format)
      logging.SetBackend(backend2Formatter)
  
      Log.Info("info")
      Log.Notice("notice")
      Log.Warning("warning")
      Log.Error("err")
      Log.Critical("crit")
  }
  </code></pre>
  
  <p>Then tried to add it into my controller by importing and running <code>Log.Error("test")</code> but I get the error of <code>undefined: Log in Log.Error</code></p>