Modifying example to allow for both json and text formats

and regenerating the non-TTY text output example just in case I
converted it wrong.
This commit is contained in:
Dan Buch
2014-04-20 15:38:09 -04:00
parent 7c14fae98a
commit 058bed65b7
2 changed files with 12 additions and 6 deletions
+7 -1
View File
@@ -1,12 +1,18 @@
package main
import (
"os"
"github.com/Sirupsen/logrus"
)
func main() {
log := logrus.New()
log.Formatter = new(logrus.JSONFormatter)
if os.Getenv("LOG_FORMAT") == "json" {
log.Formatter = new(logrus.JSONFormatter)
} else {
log.Formatter = new(logrus.TextFormatter)
}
for {
log.WithFields(logrus.Fields{