I can see that it can be confusing to have logs in development that you don’t know what timezone it belongs to. E.g. you develop something, then you go on a trip, where the timezone is different. In your logs you then have time stamps, but you are not sure which time zone they belong to. So you don’t know exactly when something happened. Or instead of changing the timezone setting on your computer you change your setting in config/config.exs for using UTC with logger or not. Again, in the saved logging data you don’t know which it is.
Also what if you have one config UTC in production and another for “local time” on a development machine? You might be looking at local time one second, and UTC the next without being able to tell which is which.
If they were DateTime structs in UTC then you have the information right there in front of you. Instead of printing e.g. "16:35:42.938", the default could be “3 May 16:35:42.938 UTC”. Any developer used to checking timestamps on a server running UTC is used to reading UTC timestamps anyway. And with the information right there on the screen is no need to figure out if it is in UTC or not.
Logging tools could make use of this information too. For tools to compare logging timestamps to other timestamps, it needs to know what the timestamps are in UTC. Today, the only way to do this without over complicated code is to write in the documentation “put this in your settings to set logger to use UTC or set your local time to UTC and hope it doesn't change”.
In 1998 NASA launched a spacecraft to Mars. They also had a system outputting numbers. The software relied on the document saying that the numbers were to be in metric units. Someone didn’t follow the document. The spacecraft disintegrated.
https://en.wikipedia.org/wiki/Mars_Climate_OrbiterWhen you have the UTC offset data right there, as you do with a DateTime struct, it gives an assurance that you don’t have when relying on people reading and following documentation. Pattern matching against a time_zone field is a lot more reliable.
- Lau