initial
This commit is contained in:
18
json_handler.go
Normal file
18
json_handler.go
Normal file
@@ -0,0 +1,18 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user