rs / zerolog

Zero Allocation JSON Logger
MIT License
10.62k stars 572 forks source link

timestamp as a float64 with second precision and micro seconds ? #425

Open chmike opened 2 years ago

chmike commented 2 years ago

Looking at Caddy that uses zap, I see that their time stamp are float64 with second units and micro second precision. The advantage is that a change in precision doesn't break logging interpreters. I'm aware that floating point computation is a little slower, but compatibility is more important than speed in my case.

How can I replace the default time stamp output of zerolog with my own that would output a float64 value. I would also like to change the field name into "ts" which is more compact.