Logging
Contoh code
Last updated
Last updated
package main
import (
"fmt"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
)
func main() {
zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
log.Debug().
Str("Scale", "833 cents").
Float64("Interval", 833.09).
Bool("IsSuccess", true).
Any("Some Interface", "example").
AnErr("Error", fmt.Errorf("some error")).
Msg("Fibonacci is everywhere")
log.Debug().
Str("Name", "Tom").
Send()
}{"level":"debug","Scale":"833 cents","Interval":833.09,"time":1562212768,"message":"Fibonacci is everywhere"}
{"level":"debug","Name":"Tom","time":1562212768}