Optional parameter to specify the time format. If not provided, it will use the LOG_TIME environment variable or default to none.
Returns string
the time formatted for Logs
Remarks
The format included ANSI escape codes to color the timestamp in intense black, and it resets the color after the timestamp. If none is selected, it simply resets the color without adding any timestamp.
Formats the current time for log messages
The
logTimeparameter orLOG_TIMEenvironment variable can be set to one of the following values (case-insensitive):none- No timestamp will be included in the logs.iso- The timestamp will be in ISO 8601 format (e.g.2024-06-01T12:00:00.000Z).locale- The timestamp will be in the local date and time format (e.g.6/1/2024, 12:00:00 PM).unix- The timestamp will be in Unix time format (i.e. seconds since January 1, 1970).time- The timestamp will include only the local time (e.g.12:00:00 PM).