title: Golang logrus logs available in console but not being sent to loggly
body: <p>I have a golang project and I'm trying to use loggly logging as explained in their blog at <a href="https://www.loggly.com/blog/logging-to-loggly-from-go-with-logrus-and-logrusly/" rel="nofollow">https://www.loggly.com/blog/logging-to-loggly-from-go-with-logrus-and-logrusly/</a></p>
  
  <p>The problem is that with their example, things are fine but I have a bunch of files and dozens of functions (which handle API calls) and I don't want to go about re-initializing the logger instance every time.</p>
  
  <p>This works perfectly in main.go</p>
  
  <pre><code>log := logrus.New()
  hook := logrusly.NewLogglyHook(logglyToken, domain, logrus.WarnLevel, logglyUsername, logglyPassword)
  log.Hooks.Add(hook)
  log.Info("Welcome")
  hook.Flush()
  </code></pre>
  
  <p>and I'm able to see this message in my loggly account.</p>
  
  <p>But, if I do something like this - </p>
  
  <pre><code>func LogrusLogger(loglevel string, message interface{}){
      log := logrus.New()
      hook := logrusly.NewLogglyHook(logglyToken, domain, logrus.WarnLevel, logglyUsername, logglyPassword)
      log.Hooks.Add(hook)
  
      log.Info(loglevel, message)
      hook.Flush()
  }
  </code></pre>
  
  <p>then upon calling this function, the logs can be seen in the program console but not in the loggly account specified.
  Am I calling the hook.Flush() correctly? (Because I'm assuming that's the point where the logs get sent to the loggly server)</p>
  
  <p>Additional info:
  The first piece of code is in <code>main.go</code> inside the <code>main()</code> function</p>
  
  <p>The second piece of code is in <code>utility.go</code> which has a package utility and I call the function as <code>utility.LogrusLogger(loglevel, message)</code> wherever I want after importing the package utility in that file.
  I'm pretty sure things are fine as I'm able to see the logs in the program console.</p>