log.zig
log.zig copied to clipboard
Improved timestamp formatting
The Unix Epoch time is not human readable. I suggest this library allow users to change the timestamp format to whatever they like. https://github.com/gernest/time is a Zig port of the Go time package that gives users the ability to format a timestamp in any whatever way they like. I am new to Zig so I am uncertain how package dependencies work, but perhaps log.zig could detect if the time library is linked to a binary and expose options to the user? I'll work on creating a PR.
POC commits of above have output like:
2020-05-11T21:27:06-07:00 [INFO]: FOO
2020-05-11T21:27:06-07:00 [INFO]: BAR
2020-05-11T21:27:06-07:00 [WARN]: BAZ
2020-05-11T21:27:06-07:00 [ERROR]: An error occurred!
This allows users to set a date handler function to format dates without adding dependencies to log.zig itself.