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 CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0 || ^4.0.0"
6
6
  },
7
- "version": "1.2.0",
7
+ "version": "1.2.1",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -15,15 +15,15 @@ export function getRequestId() {
15
15
  }
16
16
  function formatTimestamp() {
17
17
  const now = /* @__PURE__ */ new Date();
18
- const isoString = now.toISOString();
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 hours = String(Math.floor(absOffset / 60)).padStart(2, "0");
23
- const minutes = String(absOffset % 60).padStart(2, "0");
24
- const timezone = `${sign}${hours}${minutes}`;
25
- const timestampWithMicros = isoString.replace("Z", `${Math.floor(Math.random() * 1e3).toString().padStart(3, "0")}${timezone}`);
26
- return timestampWithMicros;
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hotelme-nuxt-logger",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Стандартний logger для Nuxt проектів з JSON виводом сумісним з бекенд-логами",
5
5
  "keywords": [
6
6
  "nuxt",