const options = { year: 'numeric', day: '2-digit', month: '2-digit', hour: '2-digit', 'minute': '2-digit', second: '2-digit' }; const osLocale = (process.env.LANG || process.env.LANGUAGE || process.env.LC_ALL || process.env.LC_MESSAGES).split('.')[0].replace('_', '-'); const dtFormat = Intl.DateTimeFormat(osLocale, options); export const getTime = () => { return dtFormat.format(new Date()); } export const log = (src, msg) => { const time = getTime(); console.log(`${time} : ${src} : ${msg}`); }; export const error = (src, msg) => { const time = new Date().toISOString(); console.error(`${time} : ${src} : ${msg}`); }