readme: update with example of logging to file

This commit is contained in:
Simon Eskildsen
2017-02-06 19:16:20 -05:00
parent 11fbf0fa42
commit 141e6dc6a6
3 changed files with 21 additions and 4 deletions
+9 -1
View File
@@ -2,7 +2,7 @@ package main
import (
"github.com/Sirupsen/logrus"
"os"
// "os"
)
var log = logrus.New()
@@ -10,6 +10,14 @@ var log = logrus.New()
func init() {
log.Formatter = new(logrus.JSONFormatter)
log.Formatter = new(logrus.TextFormatter) // default
// file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY, 0666)
// if err == nil {
// log.Out = file
// } else {
// log.Info("Failed to log to file, using default stderr")
// }
log.Level = logrus.DebugLevel
}