github.com/jiasir/deis@v1.12.2/router/logger/stdout_formatter.go (about)

     1  package logger
     2  
     3  import (
     4  	"bytes"
     5  	"fmt"
     6  	"strings"
     7  
     8  	"github.com/Sirupsen/logrus"
     9  )
    10  
    11  // StdOutFormatter formats log messages from the router component.
    12  type StdOutFormatter struct {
    13  }
    14  
    15  // Format rewrites a log entry for stdout as a byte array.
    16  func (f *StdOutFormatter) Format(entry *logrus.Entry) ([]byte, error) {
    17  	b := &bytes.Buffer{}
    18  	fmt.Fprintf(b, "[%s] - %s\n", strings.ToUpper(entry.Level.String()), entry.Message)
    19  	return b.Bytes(), nil
    20  }