Deviopath › Node.js

Format a Log Line

Easy · Logging

Write a function formatLog(entry) that turns a log entry { time, level, msg } into one line: "<ISO time> [<LEVEL>] <msg>".

- time is a timestamp in milliseconds, like Date.now() returns. Convert it with new Date(time).toISOString().

- level is written in upper case.

Next: Port from Environment