remove duplicated JSON
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
## dates and their corresponding seconds been here :)
|
||||
[24-11-15]
|
||||
u80864958_at_u80864958 = 979
|
||||
[25-03-11]
|
||||
schreifuchs_at_archibald = 195
|
||||
[24-11-18]
|
||||
u80864958_at_u80864958 = 3139
|
||||
[25-03-11]
|
||||
schreifuchs_at_archibald = 195
|
||||
[25-05-09]
|
||||
schreifuchs_at_archibald = 10
|
||||
|
@ -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