@nemigo/logger 2.4.0 → 2.4.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/atoms.d.ts CHANGED
@@ -3,4 +3,5 @@ import type { Caller, Mode, PrintParams } from "./types.js";
3
3
  export declare const formatTimestamp: (timestamp?: Timestamp) => string;
4
4
  export declare const flatCaller: (caller: Caller) => string;
5
5
  export declare const formatHeader: <M extends string = Mode>(caller: Caller, options: PrintParams<M>) => string;
6
+ export declare const serialize: (message: unknown) => string | boolean | number | null;
6
7
  export declare const print: <M extends string = Mode>(caller: Caller, message: unknown, options?: PrintParams<M>) => void;
package/dist/atoms.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable no-console */
2
2
  // oxlint-disable no-console
3
+ import { isObject } from "@nemigo/helpers";
3
4
  import { formatDateTime } from "@nemigo/helpers/datetime/format";
4
5
  import { emojis } from "./emojis.js";
5
6
  export const formatTimestamp = (timestamp = Date.now()) => formatDateTime(timestamp, "DD-DM-DY (TH:TM:TS)");
@@ -10,11 +11,17 @@ export const formatHeader = (caller, options) => {
10
11
  const colored = styler ? styler(process) : process;
11
12
  return emoji ? `${dated} ${colored}: ${emojis[emoji]}` : `${dated} ${colored}:`;
12
13
  };
14
+ export const serialize = (message) => {
15
+ if (message === undefined)
16
+ return "undefined";
17
+ if (isObject(message))
18
+ return JSON.stringify(message, null, 2);
19
+ return message;
20
+ };
13
21
  export const print = (caller, message, options = {}) => {
14
- const header = formatHeader(caller, options);
15
22
  if (options.separate?.before)
16
23
  console.log("");
17
- console.log(header, JSON.stringify(message === undefined ? "undefined" : message, null, 2));
24
+ console.log(formatHeader(caller, options), serialize(message));
18
25
  if (options.separate?.after)
19
26
  console.log("");
20
27
  };
package/dist/emojis.d.ts CHANGED
@@ -3,10 +3,10 @@ export declare const emojis: {
3
3
  readonly stats: "📊";
4
4
  readonly money: "💰";
5
5
  readonly details: "🔍";
6
- readonly gear: "⚙️ ";
6
+ readonly gear: "⚙️";
7
7
  readonly bot: "🤖";
8
8
  readonly info: "👀";
9
- readonly warn: "⚠️ ";
9
+ readonly warn: "⚠️";
10
10
  readonly error: "🆘";
11
11
  readonly good: "✅";
12
12
  };
package/dist/emojis.js CHANGED
@@ -2,10 +2,10 @@ export const emojis = {
2
2
  stats: "📊",
3
3
  money: "💰",
4
4
  details: "🔍",
5
- gear: "⚙️ ",
5
+ gear: "⚙️",
6
6
  bot: "🤖",
7
7
  info: "👀",
8
- warn: "⚠️ ",
8
+ warn: "⚠️",
9
9
  error: "🆘",
10
10
  good: "✅",
11
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nemigo/logger",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "private": false,
5
5
  "license": "MPL-2.0",
6
6
  "author": {
@@ -45,7 +45,7 @@
45
45
  }
46
46
  },
47
47
  "devDependencies": {
48
- "@nemigo/configs": "2.4.0",
48
+ "@nemigo/configs": "2.4.1",
49
49
  "@nemigo/helpers": "2.4.0"
50
50
  }
51
51
  }