@things-factory/env 7.1.11 → 7.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/logger.js +15 -1
- package/package.json +2 -2
package/lib/logger.js
CHANGED
@@ -29,7 +29,21 @@ if (consoleConfig) {
|
|
29
29
|
logTransports.push(new transports.Console(Object.assign({}, CONSOLE_LOGGER_CONFIG, consoleConfig)))
|
30
30
|
}
|
31
31
|
|
32
|
-
|
32
|
+
function getSystemTimeZone() {
|
33
|
+
try {
|
34
|
+
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
|
35
|
+
if (!timeZone) {
|
36
|
+
throw new Error('Unable to resolve timeZone')
|
37
|
+
}
|
38
|
+
return timeZone
|
39
|
+
} catch (e) {
|
40
|
+
console.warn('Failed to get system timeZone, falling back to UTC.', e)
|
41
|
+
return 'UTC'
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
const SYSTEM_TZ = getSystemTimeZone()
|
46
|
+
|
33
47
|
const systemTimestamp = format((info, opts) => {
|
34
48
|
if (opts.tz) info.timestamp = moment().tz(opts.tz).format()
|
35
49
|
return info
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/env",
|
3
|
-
"version": "7.1.
|
3
|
+
"version": "7.1.13",
|
4
4
|
"description": "Things Factory running environment helper library",
|
5
5
|
"main": "index.js",
|
6
6
|
"author": "heartyoh@hatiolab.com",
|
@@ -27,5 +27,5 @@
|
|
27
27
|
"winston": "^3.2.1",
|
28
28
|
"winston-daily-rotate-file": "^4.2.1"
|
29
29
|
},
|
30
|
-
"gitHead": "
|
30
|
+
"gitHead": "a1ea42d681217f4ee945f70ae37a6cce05c45a5a"
|
31
31
|
}
|