Go Package log: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 10: Line 10:


==Changing the Logging Device==
==Changing the Logging Device==
By default, the logger is set to write to <tt>stderr</tt>. To change that:


<pre>
<pre>

Revision as of 18:15, 2 April 2016

External

Internal

Recipes

Changing the Logging Device

By default, the logger is set to write to stderr. To change that:

import (
    "log"
    "os"
)
...
func init() {

    // change the device for logging to stdout
    log.SetOutput(os.Stdout)
}