Add features from README

This commit is contained in:
Simon Eskildsen
2014-03-10 19:22:08 -04:00
parent e155f76d1b
commit 53371e3664
11 changed files with 285 additions and 178 deletions
+17
View File
@@ -0,0 +1,17 @@
package logrus
import (
"encoding/json"
"fmt"
)
type JSONFormatter struct {
}
func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
serialized, err := json.Marshal(entry.Data)
if err != nil {
return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
}
return append(serialized, '\n'), nil
}