entry: break out time, level and message from data

This commit is contained in:
Simon Eskildsen
2014-07-26 21:26:04 -04:00
parent f0cb18fc85
commit 40069a98d6
6 changed files with 98 additions and 3 deletions
+4
View File
@@ -27,11 +27,15 @@ func miniTS() int {
type TextFormatter struct {
// Set to true to bypass checking for a TTY before outputting colors.
ForceColors bool
*internalFormatter
}
func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
b := &bytes.Buffer{}
f.prefixFieldClashes(entry)
if f.ForceColors || IsTerminal() {
levelText := strings.ToUpper(entry.Data["level"].(string))[0:4]