entry: break out time, level and message from data
This commit is contained in:
@@ -261,6 +261,9 @@ type MyJSONFormatter struct {
|
||||
log.Formatter = new(MyJSONFormatter)
|
||||
|
||||
func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
|
||||
// Note this doesn't include Time, Level and Message which are available on
|
||||
// the Entry. Consult `godoc` on information about those fields or read the
|
||||
// source of the official loggers.
|
||||
serialized, err := json.Marshal(entry.Data)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
|
||||
|
||||
Reference in New Issue
Block a user