icyleaf / halite

💎HTTP Requests Client with a chainable REST API, built-in sessions and middlewares.
MIT License
170 stars 13 forks source link

Improve logging format #102

Closed icyleaf closed 3 years ago

icyleaf commented 3 years ago

Fix issue duplicate timestamp then add configuring location of timezone from ENV["TZ"]

Before:

2021-02-10T04:27:03.359684Z   INFO - halite: > | request  | 2021-02-10T12:27:03+08:00 GET    | https://httpbin.org/get
2021-02-10T04:27:04.860510Z   INFO - halite: < | response | 2021-02-10T12:27:04+08:00 200    | https://httpbin.org/get | 1.5s | application/json

After:

2021-02-10T12:21:12+08:00 halite: > | request  |  GET    | https://httpbin.org/get
2021-02-10T12:21:13+08:00 halite: < | response |  200    | https://httpbin.org/get | 1.36s | application/json

Note: It invalid by calling Log.setup or Log.setup_from_env outside of Halite by setted ENV["TZ"]

Relates #101