remove duplicated JSON
This commit is contained in:
@ -32,26 +32,3 @@ func JSON(logs <-chan *logger.Log) {
|
||||
println(string(out))
|
||||
}
|
||||
}
|
||||
|
||||
// JSON logs to std wit the schema:
|
||||
// {"time":"","level":"","message":""}.
|
||||
func JSON(logs <-chan *logger.Log) {
|
||||
for log := range logs {
|
||||
timedLog := struct {
|
||||
Time time.Time `json:"time"`
|
||||
LVL lvl.Level `json:"level"`
|
||||
Message string `json:"message"`
|
||||
}{
|
||||
Time: time.Now(),
|
||||
LVL: log.Level,
|
||||
Message: log.Message,
|
||||
}
|
||||
|
||||
out, err := json.Marshal(timedLog)
|
||||
if err != nil {
|
||||
fmt.Println("Error while marshaling log: ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
println(string(out))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user