@meadown/logger 1.3.0 → 1.4.0

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/README.md CHANGED
@@ -32,18 +32,35 @@ customLog.error("Something went wrong")
32
32
  You'll see something like:
33
33
 
34
34
  ```text
35
- [INFO] 2026-05-30T10:00:00.000Z (server.ts:42)
36
- Auth user logged in
35
+ [INFO] 2026-05-30 04:00:00 PM GMT+6 (server.ts:42)
36
+ └── Auth user logged in
37
37
  ```
38
38
 
39
- Each line is tagged by level — `[INFO]`, `[WARN]`, or `[ERROR]` — followed by the
40
- timestamp and the source location, with your arguments on the next line.
39
+ The first line carries the level tag — `[INFO]`, `[WARN]`, or `[ERROR]` — the
40
+ local timestamp with AM/PM and timezone, and the source location. Your message hangs
41
+ off a `└──` branch on the line below (colored to match the level), so it's easy to
42
+ scan down a busy terminal.
43
+
44
+ ### One thing if you re-export it
45
+
46
+ A lot of projects like to funnel everything through their own `lib/logger` file.
47
+ That's totally fine here — just pass the logger straight through instead of wrapping
48
+ it in a new function. The file and line are read from the call stack, so an extra
49
+ wrapper makes every log blame _that_ file instead of wherever you actually logged.
50
+
51
+ ```ts
52
+ // GOOD: pass it through — the (file:line) stays honest
53
+ export { default as customLog } from "@meadown/logger"
54
+
55
+ // BAD: now every log points at this file, not the real caller
56
+ export const customLog = (...args) => log(...args)
57
+ ```
41
58
 
42
59
  ## Color-coded levels
43
60
 
44
61
  The level tag is colored so you can spot what matters at a glance — `[INFO]` in
45
- cyan, `[WARN]` in yellow, `[ERROR]` in red. The timestamp and location stay plain so
46
- the color draws your eye straight to the level.
62
+ cyan, `[WARN]` in yellow, `[ERROR]` in red. The `(file:line)` location is dimmed to
63
+ light gray so it stays out of the way, and the timestamp is left plain.
47
64
 
48
65
  Colors appear automatically when you're in a terminal. When output is piped to a
49
66
  file or another program, the tag prints as plain `[INFO]` text — no stray color
@@ -51,7 +68,7 @@ codes in your log files. Nothing to configure.
51
68
 
52
69
  ## Click to open the source
53
70
 
54
- That `(server.ts:42)` at the end of every log isn't just text — when you're in a
71
+ That `(server.ts:42)` at the end of every log isn't just text — when you are in a
55
72
  terminal, it's a **clickable link** that opens the file the log came from. No more
56
73
  hunting for where a message came from, and the line number is right there in the
57
74
  label.
@@ -6,11 +6,11 @@ export interface LogFN {
6
6
  }
7
7
  /**
8
8
  * Logs to the console, but only outside production. Each line is prefixed with
9
- * a level tag, an ISO timestamp, and a clickable link to the file and line it
10
- * was called from; all arguments are then printed as-is.
9
+ * a level tag, a local AM/PM timestamp with timezone, and a clickable link to
10
+ * the file it was called from; all arguments are then printed as-is.
11
11
  * @example
12
12
  * customLog("Auth", "user logged in")
13
- * // [INFO] 2026-05-30T10:00:00.000Z (server.ts:42) Auth user logged in
13
+ * // [INFO] 2026-05-30 04:00:00 PM GMT+6 (server.ts:42) Auth user logged in
14
14
  */
15
15
  declare const customLog: LogFN;
16
16
  export { customLog };
package/dist/cjs/index.js CHANGED
@@ -10,11 +10,11 @@ exports.customLog = void 0;
10
10
  const index_js_1 = require("./utils/index.js");
11
11
  /**
12
12
  * Logs to the console, but only outside production. Each line is prefixed with
13
- * a level tag, an ISO timestamp, and a clickable link to the file and line it
14
- * was called from; all arguments are then printed as-is.
13
+ * a level tag, a local AM/PM timestamp with timezone, and a clickable link to
14
+ * the file it was called from; all arguments are then printed as-is.
15
15
  * @example
16
16
  * customLog("Auth", "user logged in")
17
- * // [INFO] 2026-05-30T10:00:00.000Z (server.ts:42) Auth user logged in
17
+ * // [INFO] 2026-05-30 04:00:00 PM GMT+6 (server.ts:42) Auth user logged in
18
18
  */
19
19
  const customLog = Object.assign((0, index_js_1.createLog)("log", "[INFO]"), {
20
20
  error: (0, index_js_1.createLog)("error", "[ERROR]"),
@@ -3,6 +3,7 @@ declare const CODES: {
3
3
  readonly red: 31;
4
4
  readonly yellow: 33;
5
5
  readonly cyan: 36;
6
+ readonly gray: 90;
6
7
  readonly dim: 2;
7
8
  };
8
9
  /** The named colors/styles {@link colorize} understands. */
@@ -13,6 +13,7 @@ const CODES = {
13
13
  red: 31,
14
14
  yellow: 33,
15
15
  cyan: 36,
16
+ gray: 90, // bright black — renders as light gray
16
17
  dim: 2,
17
18
  };
18
19
  const RESET = "\x1b[0m";
@@ -23,9 +23,10 @@ const TAG_COLOR = {
23
23
  };
24
24
  /**
25
25
  * Renders a caller as a `(file:line)` location. When the terminal supports
26
- * OSC-8 hyperlinks, the location is a clickable link to the exact source line;
27
- * otherwise it's plain text. Pure (no stack access), so it can be called from a
28
- * helper without disturbing {@link getCaller}'s frame depth.
26
+ * OSC-8 hyperlinks, the location is a clickable link to the source file while
27
+ * the line stays visible in the label; otherwise it's plain text. Pure (no
28
+ * stack access), so it can be called from a helper without disturbing
29
+ * {@link getCaller}'s frame depth.
29
30
  */
30
31
  function formatLocation(caller, streamName) {
31
32
  if (caller.file !== null &&
@@ -48,10 +49,15 @@ function createLog(channel, tag) {
48
49
  return;
49
50
  const caller = (0, getCaller_js_1.default)();
50
51
  const location = formatLocation(caller, streamName);
51
- // Color only the level tag, and only on a real terminal.
52
- const tagOut = (0, color_js_1.supportsColor)(streamName)
53
- ? (0, color_js_1.colorize)(tag, TAG_COLOR[channel])
54
- : tag;
55
- console[channel](tagOut, (0, getTimeStamp_js_1.default)(), `(${location})`, `\n`, ...args, `\n`);
52
+ // On a real terminal: color the level tag and the `└──` connector (same
53
+ // color), and dim the location to gray. The timestamp stays plain.
54
+ const useColor = (0, color_js_1.supportsColor)(streamName);
55
+ const color = TAG_COLOR[channel];
56
+ const tagOut = useColor ? (0, color_js_1.colorize)(tag, color) : tag;
57
+ const locOut = useColor ? (0, color_js_1.colorize)(`(${location})`, "gray") : `(${location})`;
58
+ const connector = useColor ? (0, color_js_1.colorize)("└──", color) : "└──";
59
+ // `\n` + connector puts the message on its own line under a tree branch;
60
+ // console's separator space sits between the connector and the message.
61
+ console[channel](tagOut, (0, getTimeStamp_js_1.default)(), locOut, `\n${connector}`, ...args, `\n`);
56
62
  };
57
63
  }
@@ -1,2 +1,6 @@
1
- /** Returns the current time as an ISO-8601 string, e.g. `2026-05-30T10:00:00.000Z`. */
2
- export default function getTimeStamp(): string;
1
+ /**
2
+ * Returns local time as an ISO date plus a readable AM/PM time and timezone,
3
+ * e.g. `2026-05-29 04:00:00 PM GMT+6`. The date and time are both local, so they
4
+ * stay consistent.
5
+ */
6
+ export default function getTimeStamp(date?: Date): string;
@@ -7,7 +7,23 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.default = getTimeStamp;
10
- /** Returns the current time as an ISO-8601 string, e.g. `2026-05-30T10:00:00.000Z`. */
11
- function getTimeStamp() {
12
- return new Date().toISOString();
10
+ // Time-only formatter (date is built separately so it stays ISO `YYYY-MM-DD`).
11
+ const TIME_FORMATTER = new Intl.DateTimeFormat("en-US", {
12
+ hour: "2-digit",
13
+ minute: "2-digit",
14
+ second: "2-digit",
15
+ hour12: true,
16
+ timeZoneName: "short",
17
+ });
18
+ function pad(value) {
19
+ return String(value).padStart(2, "0");
20
+ }
21
+ /**
22
+ * Returns local time as an ISO date plus a readable AM/PM time and timezone,
23
+ * e.g. `2026-05-29 04:00:00 PM GMT+6`. The date and time are both local, so they
24
+ * stay consistent.
25
+ */
26
+ function getTimeStamp(date = new Date()) {
27
+ const datePart = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
28
+ return `${datePart} ${TIME_FORMATTER.format(date)}`;
13
29
  }
package/dist/index.d.ts CHANGED
@@ -6,11 +6,11 @@ export interface LogFN {
6
6
  }
7
7
  /**
8
8
  * Logs to the console, but only outside production. Each line is prefixed with
9
- * a level tag, an ISO timestamp, and a clickable link to the file and line it
10
- * was called from; all arguments are then printed as-is.
9
+ * a level tag, a local AM/PM timestamp with timezone, and a clickable link to
10
+ * the file it was called from; all arguments are then printed as-is.
11
11
  * @example
12
12
  * customLog("Auth", "user logged in")
13
- * // [INFO] 2026-05-30T10:00:00.000Z (server.ts:42) Auth user logged in
13
+ * // [INFO] 2026-05-30 04:00:00 PM GMT+6 (server.ts:42) Auth user logged in
14
14
  */
15
15
  declare const customLog: LogFN;
16
16
  export { customLog };
package/dist/index.js CHANGED
@@ -7,11 +7,11 @@
7
7
  import { createLog } from "./utils/index.js";
8
8
  /**
9
9
  * Logs to the console, but only outside production. Each line is prefixed with
10
- * a level tag, an ISO timestamp, and a clickable link to the file and line it
11
- * was called from; all arguments are then printed as-is.
10
+ * a level tag, a local AM/PM timestamp with timezone, and a clickable link to
11
+ * the file it was called from; all arguments are then printed as-is.
12
12
  * @example
13
13
  * customLog("Auth", "user logged in")
14
- * // [INFO] 2026-05-30T10:00:00.000Z (server.ts:42) Auth user logged in
14
+ * // [INFO] 2026-05-30 04:00:00 PM GMT+6 (server.ts:42) Auth user logged in
15
15
  */
16
16
  const customLog = Object.assign(createLog("log", "[INFO]"), {
17
17
  error: createLog("error", "[ERROR]"),
@@ -3,6 +3,7 @@ declare const CODES: {
3
3
  readonly red: 31;
4
4
  readonly yellow: 33;
5
5
  readonly cyan: 36;
6
+ readonly gray: 90;
6
7
  readonly dim: 2;
7
8
  };
8
9
  /** The named colors/styles {@link colorize} understands. */
@@ -1 +1 @@
1
- {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/utils/color.ts"],"names":[],"mappings":"AAOA,4DAA4D;AAC5D,QAAA,MAAM,KAAK;;;;;CAKD,CAAA;AAEV,4DAA4D;AAC5D,MAAM,MAAM,KAAK,GAAG,MAAM,OAAO,KAAK,CAAA;AAItC;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAItE"}
1
+ {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/utils/color.ts"],"names":[],"mappings":"AAOA,4DAA4D;AAC5D,QAAA,MAAM,KAAK;;;;;;CAMD,CAAA;AAEV,4DAA4D;AAC5D,MAAM,MAAM,KAAK,GAAG,MAAM,OAAO,KAAK,CAAA;AAItC;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAItE"}
@@ -9,6 +9,7 @@ const CODES = {
9
9
  red: 31,
10
10
  yellow: 33,
11
11
  cyan: 36,
12
+ gray: 90, // bright black — renders as light gray
12
13
  dim: 2,
13
14
  };
14
15
  const RESET = "\x1b[0m";
@@ -1 +1 @@
1
- {"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/utils/color.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,4DAA4D;AAC5D,MAAM,KAAK,GAAG;IACZ,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,GAAG,EAAE,CAAC;CACE,CAAA;AAKV,MAAM,KAAK,GAAG,SAAS,CAAA;AAEvB;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,KAAY;IACjD,OAAO,QAAQ,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,GAAG,KAAK,EAAE,CAAA;AAC/C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,UAA+B;IAC3D,IAAI,OAAO,OAAO,KAAK,WAAW;QAAE,OAAO,KAAK,CAAA;IAChD,MAAM,MAAM,GAAG,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAA;IACxE,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AAC/B,CAAC"}
1
+ {"version":3,"file":"color.js","sourceRoot":"","sources":["../../src/utils/color.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,4DAA4D;AAC5D,MAAM,KAAK,GAAG;IACZ,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE,EAAE,uCAAuC;IACjD,GAAG,EAAE,CAAC;CACE,CAAA;AAKV,MAAM,KAAK,GAAG,SAAS,CAAA;AAEvB;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,KAAY;IACjD,OAAO,QAAQ,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,GAAG,KAAK,EAAE,CAAA;AAC/C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,UAA+B;IAC3D,IAAI,OAAO,OAAO,KAAK,WAAW;QAAE,OAAO,KAAK,CAAA;IAChD,MAAM,MAAM,GAAG,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAA;IACxE,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AAC/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createLog.d.ts","sourceRoot":"","sources":["../../src/utils/createLog.ts"],"names":[],"mappings":"AAaA,iDAAiD;AACjD,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;AA4BjD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,OAAO,EAAE,UAAU,EACnB,GAAG,EAAE,MAAM,GACV,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAc9B"}
1
+ {"version":3,"file":"createLog.d.ts","sourceRoot":"","sources":["../../src/utils/createLog.ts"],"names":[],"mappings":"AAaA,iDAAiD;AACjD,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAA;AA6BjD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,OAAO,EAAE,UAAU,EACnB,GAAG,EAAE,MAAM,GACV,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAmB9B"}
@@ -17,9 +17,10 @@ const TAG_COLOR = {
17
17
  };
18
18
  /**
19
19
  * Renders a caller as a `(file:line)` location. When the terminal supports
20
- * OSC-8 hyperlinks, the location is a clickable link to the exact source line;
21
- * otherwise it's plain text. Pure (no stack access), so it can be called from a
22
- * helper without disturbing {@link getCaller}'s frame depth.
20
+ * OSC-8 hyperlinks, the location is a clickable link to the source file while
21
+ * the line stays visible in the label; otherwise it's plain text. Pure (no
22
+ * stack access), so it can be called from a helper without disturbing
23
+ * {@link getCaller}'s frame depth.
23
24
  */
24
25
  function formatLocation(caller, streamName) {
25
26
  if (caller.file !== null &&
@@ -42,11 +43,16 @@ export default function createLog(channel, tag) {
42
43
  return;
43
44
  const caller = getCaller();
44
45
  const location = formatLocation(caller, streamName);
45
- // Color only the level tag, and only on a real terminal.
46
- const tagOut = supportsColor(streamName)
47
- ? colorize(tag, TAG_COLOR[channel])
48
- : tag;
49
- console[channel](tagOut, getTimeStamp(), `(${location})`, `\n`, ...args, `\n`);
46
+ // On a real terminal: color the level tag and the `└──` connector (same
47
+ // color), and dim the location to gray. The timestamp stays plain.
48
+ const useColor = supportsColor(streamName);
49
+ const color = TAG_COLOR[channel];
50
+ const tagOut = useColor ? colorize(tag, color) : tag;
51
+ const locOut = useColor ? colorize(`(${location})`, "gray") : `(${location})`;
52
+ const connector = useColor ? colorize("└──", color) : "└──";
53
+ // `\n` + connector puts the message on its own line under a tree branch;
54
+ // console's separator space sits between the connector and the message.
55
+ console[channel](tagOut, getTimeStamp(), locOut, `\n${connector}`, ...args, `\n`);
50
56
  };
51
57
  }
52
58
  //# sourceMappingURL=createLog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createLog.js","sourceRoot":"","sources":["../../src/utils/createLog.ts"],"names":[],"m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C,YAAY,EAAE;YAAE,OAAM;QAC3B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;QAC1B,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;QAEnD,wEAAwE;QACxE,mEAAmE;QACnE,MAAM,QAAQ,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;QAC1C,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAA;QAChC,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;QACpD,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,GAAG,CAAA;QAC7E,MAAM,SAAS,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QAE3D,yEAAyE;QACzE,wEAAwE;QACxE,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,EAAE,GAAG,IAAI,EAAE,IAAI,CAAC,CAAA;IACnF,CAAC,CAAA;AACH,CAAC"}
@@ -1,3 +1,7 @@
1
- /** Returns the current time as an ISO-8601 string, e.g. `2026-05-30T10:00:00.000Z`. */
2
- export default function getTimeStamp(): string;
1
+ /**
2
+ * Returns local time as an ISO date plus a readable AM/PM time and timezone,
3
+ * e.g. `2026-05-29 04:00:00 PM GMT+6`. The date and time are both local, so they
4
+ * stay consistent.
5
+ */
6
+ export default function getTimeStamp(date?: Date): string;
3
7
  //# sourceMappingURL=getTimeStamp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getTimeStamp.d.ts","sourceRoot":"","sources":["../../src/utils/getTimeStamp.ts"],"names":[],"mappings":"AAOA,uFAAuF;AACvF,MAAM,CAAC,OAAO,UAAU,YAAY,IAAI,MAAM,CAE7C"}
1
+ {"version":3,"file":"getTimeStamp.d.ts","sourceRoot":"","sources":["../../src/utils/getTimeStamp.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,IAAI,OAAa,GAAG,MAAM,CAG9D"}
@@ -4,8 +4,24 @@
4
4
  * Copyright (c) 2026 dewan-meadown
5
5
  * All rights reserved
6
6
  */
7
- /** Returns the current time as an ISO-8601 string, e.g. `2026-05-30T10:00:00.000Z`. */
8
- export default function getTimeStamp() {
9
- return new Date().toISOString();
7
+ // Time-only formatter (date is built separately so it stays ISO `YYYY-MM-DD`).
8
+ const TIME_FORMATTER = new Intl.DateTimeFormat("en-US", {
9
+ hour: "2-digit",
10
+ minute: "2-digit",
11
+ second: "2-digit",
12
+ hour12: true,
13
+ timeZoneName: "short",
14
+ });
15
+ function pad(value) {
16
+ return String(value).padStart(2, "0");
17
+ }
18
+ /**
19
+ * Returns local time as an ISO date plus a readable AM/PM time and timezone,
20
+ * e.g. `2026-05-29 04:00:00 PM GMT+6`. The date and time are both local, so they
21
+ * stay consistent.
22
+ */
23
+ export default function getTimeStamp(date = new Date()) {
24
+ const datePart = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
25
+ return `${datePart} ${TIME_FORMATTER.format(date)}`;
10
26
  }
11
27
  //# sourceMappingURL=getTimeStamp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getTimeStamp.js","sourceRoot":"","sources":["../../src/utils/getTimeStamp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uFAAuF;AACvF,MAAM,CAAC,OAAO,UAAU,YAAY;IAClC,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;AACjC,CAAC"}
1
+ {"version":3,"file":"getTimeStamp.js","sourceRoot":"","sources":["../../src/utils/getTimeStamp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,+EAA+E;AAC/E,MAAM,cAAc,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;IACtD,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,IAAI;IACZ,YAAY,EAAE,OAAO;CACtB,CAAC,CAAA;AAEF,SAAS,GAAG,CAAC,KAAa;IACxB,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;AACvC,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE;IACpD,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAA;IAC3F,OAAO,GAAG,QAAQ,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAA;AACrD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meadown/logger",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "A tiny, zero-dependency logger for Node.js and TypeScript that tags each line, timestamps it, shows the source file and line, and goes quiet in production.",
5
5
  "keywords": [
6
6
  "logger",