19 lines
273 B
Go
19 lines
273 B
Go
|
package simplelog
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"log"
|
||
|
)
|
||
|
|
||
|
type JSONHandler struct{}
|
||
|
|
||
|
func NewJSONHandler() *JSONHandler {
|
||
|
return &JSONHandler{}
|
||
|
}
|
||
|
|
||
|
func (j *JSONHandler) Log(event Event) error {
|
||
|
jsonData, _ := json.Marshal(event)
|
||
|
log.Println(string(jsonData))
|
||
|
return nil
|
||
|
}
|