hotelme-nuxt-logger 1.2.0 → 1.2.1
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/dist/module.json +1 -1
- package/dist/runtime/logger.js +6 -6
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/runtime/logger.js
CHANGED
|
@@ -15,15 +15,15 @@ export function getRequestId() {
|
|
|
15
15
|
}
|
|
16
16
|
function formatTimestamp() {
|
|
17
17
|
const now = /* @__PURE__ */ new Date();
|
|
18
|
-
const
|
|
18
|
+
const pad = (value, width = 2) => String(value).padStart(width, "0");
|
|
19
19
|
const offset = -now.getTimezoneOffset();
|
|
20
20
|
const sign = offset >= 0 ? "+" : "-";
|
|
21
21
|
const absOffset = Math.abs(offset);
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
return
|
|
22
|
+
const timezone = `${sign}${pad(Math.floor(absOffset / 60))}${pad(absOffset % 60)}`;
|
|
23
|
+
const micros = `${pad(now.getMilliseconds(), 3)}000`;
|
|
24
|
+
const date = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`;
|
|
25
|
+
const time = `${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}.${micros}`;
|
|
26
|
+
return `${date}T${time}${timezone}`;
|
|
27
27
|
}
|
|
28
28
|
export function log(level, msg, details) {
|
|
29
29
|
const reqid = details?.reqid || getRequestId();
|