rs / zerolog

Zero Allocation JSON Logger
MIT License
10.41k stars 567 forks source link

Set / modify time format per logger instance #487

Open v-byte-cpu opened 1 year ago

v-byte-cpu commented 1 year ago

I would like to change a time format for different logger instances, but currently the time format is set by the global constant zerolog.TimeFieldFormat and used explicitly in timestamp hook https://github.com/rs/zerolog/blob/55aaf043cf4d84249a6d2344ef18d82279d08955/event.go#L647-L653:

phuslu commented 1 year ago

You catch it, that's one reason of why I re-write another similar logger instead of forking. maybe worth see https://github.com/phuslu/log#logger

v-byte-cpu commented 1 year ago

seems pretty good, will try it soon