nightingale 16.0.0 → 16.2.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +9 -0
  3. package/dist/definitions/formatter-utils/formatObject.d.ts.map +1 -1
  4. package/dist/definitions/formatter-utils/formatStyles.d.ts +14 -0
  5. package/dist/definitions/formatter-utils/formatStyles.d.ts.map +1 -0
  6. package/dist/definitions/formatter-utils/styleToHexColor.d.ts +0 -2
  7. package/dist/definitions/formatter-utils/styleToHexColor.d.ts.map +1 -1
  8. package/dist/definitions/formatter-utils/styleToHtmlStyle.d.ts +4 -8
  9. package/dist/definitions/formatter-utils/styleToHtmlStyle.d.ts.map +1 -1
  10. package/dist/definitions/formatters/ANSIFormatter.d.ts.map +1 -1
  11. package/dist/definitions/index.d.ts +1 -0
  12. package/dist/definitions/index.d.ts.map +1 -1
  13. package/dist/definitions/loggers/LoggerCLI.d.ts +1 -1
  14. package/dist/definitions/loggers/LoggerCLI.d.ts.map +1 -1
  15. package/dist/index-browser.es.js +116 -35
  16. package/dist/index-browser.es.js.map +1 -1
  17. package/dist/index-node20.mjs +116 -35
  18. package/dist/index-node20.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/src/formatter-utils/formatObject.test.ts +69 -6
  21. package/src/formatter-utils/formatObject.ts +86 -14
  22. package/src/formatter-utils/formatRecordToString.ts +2 -2
  23. package/src/formatter-utils/formatStyles.ts +15 -0
  24. package/src/formatter-utils/styleToHexColor.ts +0 -2
  25. package/src/formatter-utils/styleToHtmlStyle.ts +1 -8
  26. package/src/formatters/ANSIFormatter.test.ts +1 -1
  27. package/src/formatters/ANSIFormatter.ts +1 -4
  28. package/src/index.ts +1 -0
  29. package/src/loggers/LoggerCLI.ts +16 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [16.2.0](https://github.com/christophehurpeau/nightingale/compare/v16.1.0...v16.2.0) (2025-03-30)
7
+
8
+ ### Features
9
+
10
+ * improve format object and allow overriding styles ([f9e787c](https://github.com/christophehurpeau/nightingale/commit/f9e787c13bc0c3eeb57a70dfc31ca95ab40ce56b)), closes [#284](https://github.com/christophehurpeau/nightingale/issues/284)
11
+
12
+ ## [16.1.0](https://github.com/christophehurpeau/nightingale/compare/v16.0.0...v16.1.0) (2025-03-30)
13
+
14
+ ### Features
15
+
16
+ * support async in logger cli group ([e27d763](https://github.com/christophehurpeau/nightingale/commit/e27d7638538690b73f45a286cc4c5bdba759f159))
17
+
6
18
  ## [16.0.0](https://github.com/christophehurpeau/nightingale/compare/v15.0.0...v16.0.0) (2025-03-30)
7
19
 
8
20
  ### ⚠ BREAKING CHANGES
package/README.md CHANGED
@@ -409,3 +409,12 @@ export function someAction(arg1) {
409
409
  logger.info("done");
410
410
  }
411
411
  ```
412
+
413
+ ## Customize format styles
414
+
415
+ ```js
416
+ import { formatStyles } from "nightingale";
417
+
418
+ formatStyles.bigint = ["green", "bold"]; // instead of default ["yellow", "bold"]
419
+ formatStyles.number = ["green"]; // instead of default ["yellow"]
420
+ ```
@@ -1 +1 @@
1
- {"version":3,"file":"formatObject.d.ts","sourceRoot":"","sources":["../../../src/formatter-utils/formatObject.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AAEhE,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AA4a9E,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,GAAE,OAAmB,EAC5B,YAAY,CAAC,EAAE,YAAY,EAC3B,EAAE,OAAc,EAAE,QAAa,EAAE,GAAE,mBAAwB,GAC1D,MAAM,CAkBR"}
1
+ {"version":3,"file":"formatObject.d.ts","sourceRoot":"","sources":["../../../src/formatter-utils/formatObject.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;AAEhE,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAmf9E,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,OAAO,GAAE,OAAmB,EAC5B,YAAY,CAAC,EAAE,YAAY,EAC3B,EAAE,OAAc,EAAE,QAAa,EAAE,GAAE,mBAAwB,GAC1D,MAAM,CAkBR"}
@@ -0,0 +1,14 @@
1
+ export declare const formatStyles: {
2
+ bigint: string[];
3
+ boolean: string[];
4
+ date: string[];
5
+ error: string[];
6
+ function: string[];
7
+ null: string[];
8
+ number: string[];
9
+ regexp: string[];
10
+ string: string[];
11
+ symbol: string[];
12
+ undefined: string[];
13
+ };
14
+ //# sourceMappingURL=formatStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatStyles.d.ts","sourceRoot":"","sources":["../../../src/formatter-utils/formatStyles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;;;;;;;;;CAYxB,CAAC"}
@@ -1,7 +1,5 @@
1
1
  export declare const styleToHexColor: {
2
2
  readonly orange: "ff5f00";
3
- readonly grayLight: "808080";
4
- readonly "gray-light": "808080";
5
3
  };
6
4
  export type StyleToHexColor = Readonly<Record<keyof typeof styleToHexColor, string>>;
7
5
  //# sourceMappingURL=styleToHexColor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styleToHexColor.d.ts","sourceRoot":"","sources":["../../../src/formatter-utils/styleToHexColor.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,QAAQ,CACpC,MAAM,CAAC,MAAM,OAAO,eAAe,EAAE,MAAM,CAAC,CAC7C,CAAC"}
1
+ {"version":3,"file":"styleToHexColor.d.ts","sourceRoot":"","sources":["../../../src/formatter-utils/styleToHexColor.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;CAElB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,QAAQ,CACpC,MAAM,CAAC,MAAM,OAAO,eAAe,EAAE,MAAM,CAAC,CAC7C,CAAC"}
@@ -59,6 +59,10 @@ export declare const styleToHtmlStyleThemeLight: {
59
59
  readonly open: "color: gray";
60
60
  readonly close: "color: currentcolor";
61
61
  };
62
+ readonly dim: {
63
+ readonly open: "color: #808080";
64
+ readonly close: "color: currentcolor";
65
+ };
62
66
  readonly bgBlack: {
63
67
  readonly open: "background: black";
64
68
  readonly close: "background: initial";
@@ -95,14 +99,6 @@ export declare const styleToHtmlStyleThemeLight: {
95
99
  readonly open: "color: #ff5f00";
96
100
  readonly close: "color: currentcolor";
97
101
  };
98
- readonly grayLight: {
99
- readonly open: "color: #808080";
100
- readonly close: "color: currentcolor";
101
- };
102
- readonly "gray-light": {
103
- readonly open: "color: #808080";
104
- readonly close: "color: currentcolor";
105
- };
106
102
  };
107
103
  export type StyleToHtmlStyle = Readonly<Record<keyof typeof styleToHtmlStyleThemeLight, HtmlStyle>>;
108
104
  export declare const styleToHtmlStyleThemeDark: StyleToHtmlStyle;
@@ -1 +1 @@
1
- {"version":3,"file":"styleToHtmlStyle.d.ts","sourceRoot":"","sources":["../../../src/formatter-utils/styleToHtmlStyle.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgD7B,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CACrC,MAAM,CAAC,MAAM,OAAO,0BAA0B,EAAE,SAAS,CAAC,CAC3D,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,gBAOvC,CAAC"}
1
+ {"version":3,"file":"styleToHtmlStyle.d.ts","sourceRoot":"","sources":["../../../src/formatter-utils/styleToHtmlStyle.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyC7B,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CACrC,MAAM,CAAC,MAAM,OAAO,0BAA0B,EAAE,SAAS,CAAC,CAC3D,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,gBAOvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ANSIFormatter.d.ts","sourceRoot":"","sources":["../../../src/formatters/ANSIFormatter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AA2ChD,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAe5D;AAED,eAAO,MAAM,aAAa,EAAE,oBAE3B,CAAC"}
1
+ {"version":3,"file":"ANSIFormatter.d.ts","sourceRoot":"","sources":["../../../src/formatters/ANSIFormatter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGhD,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAwChD,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAe5D;AAED,eAAO,MAAM,aAAa,EAAE,oBAE3B,CAAC"}
@@ -16,6 +16,7 @@ export { BrowserConsoleHandler } from "./handlers/BrowserConsoleHandler";
16
16
  export { ConsoleHandler } from "./handlers/ConsoleHandler";
17
17
  export { ConsoleCLIHandler } from "./handlers/ConsoleCLIHandler";
18
18
  export { LoggerCLI } from "./loggers/LoggerCLI";
19
+ export { formatStyles } from "./formatter-utils/formatStyles";
19
20
  /**
20
21
  * listen to uncaughtException and unhandledRejection
21
22
  * @param {Logger} [logger]
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO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AY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,GAAE,MAGP,GACA,IAAI,CAaN"}
@@ -18,6 +18,6 @@ export declare class LoggerCLI extends Logger {
18
18
  noticeJsonOnly(messageOrError: string, metadata: Record<string, unknown>): void;
19
19
  infoJsonOnly(messageOrError: string, metadata: Record<string, unknown>): void;
20
20
  warnJsonOnly(messageOrError: string, metadata: Record<string, unknown>): void;
21
- group(name: string, fn: () => void): void;
21
+ group<T, Result extends Awaited<T> | Promise<T>>(name: string, fn: () => Result): Result extends Promise<infer V> ? Promise<V> : Awaited<T>;
22
22
  }
23
23
  //# sourceMappingURL=LoggerCLI.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LoggerCLI.d.ts","sourceRoot":"","sources":["../../../src/loggers/LoggerCLI.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/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AAE,OAAO,CAAC,GAChC,IAAI;IAMP,KAAK,CAAC,CAAC,EAAE,MAAM,SAAS,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAC7C,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,MAAM,GACf,MAAM,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAkB7D"}
@@ -122,9 +122,7 @@ const levelToSymbol = {
122
122
  };
123
123
 
124
124
  const styleToHexColor = {
125
- orange: "ff5f00",
126
- grayLight: "808080",
127
- "gray-light": "808080"
125
+ orange: "ff5f00"
128
126
  };
129
127
 
130
128
  const styleToHtmlStyleThemeLight = {
@@ -185,6 +183,10 @@ const styleToHtmlStyleThemeLight = {
185
183
  open: "color: gray",
186
184
  close: "color: currentcolor"
187
185
  },
186
+ dim: {
187
+ open: "color: #808080",
188
+ close: "color: currentcolor"
189
+ },
188
190
  bgBlack: {
189
191
  open: "background: black",
190
192
  close: "background: initial"
@@ -220,14 +222,6 @@ const styleToHtmlStyleThemeLight = {
220
222
  orange: {
221
223
  open: `color: #${styleToHexColor.orange}`,
222
224
  close: "color: currentcolor"
223
- },
224
- grayLight: {
225
- open: `color: #${styleToHexColor.grayLight}`,
226
- close: "color: currentcolor"
227
- },
228
- "gray-light": {
229
- open: `color: #${styleToHexColor.grayLight}`,
230
- close: "color: currentcolor"
231
225
  }
232
226
  };
233
227
  const styleToHtmlStyleThemeDark = {
@@ -242,6 +236,22 @@ const styleToHtmlStyleThemeDark = {
242
236
  }
243
237
  };
244
238
 
239
+ /* eslint sort-keys: error */
240
+
241
+ const formatStyles = {
242
+ bigint: ["yellow", "bold"],
243
+ boolean: ["green"],
244
+ date: ["magenta"],
245
+ error: ["red"],
246
+ function: ["blue"],
247
+ null: ["bold"],
248
+ number: ["yellow"],
249
+ regexp: ["magenta"],
250
+ string: ["orange"],
251
+ symbol: ["magenta"],
252
+ undefined: ["dim"]
253
+ };
254
+
245
255
  /* eslint-disable @typescript-eslint/no-use-before-define */
246
256
 
247
257
  const noStyleFn = (styles, value) => value;
@@ -256,6 +266,51 @@ const sameRawFormattedValue = value => ({
256
266
  stringValue: value,
257
267
  formattedValue: value
258
268
  });
269
+ const numericSeparator = "_";
270
+ const formatIntegerValue = integerAsString => {
271
+ let result = "";
272
+ let i = integerAsString.length;
273
+ const start = integerAsString.startsWith("-") ? 1 : 0;
274
+ for (; i >= start + 4; i -= 3) {
275
+ result = `${numericSeparator}${integerAsString.slice(i - 3, i)}${result}`;
276
+ }
277
+ return i === integerAsString.length ? integerAsString : `${integerAsString.slice(0, i)}${result}`;
278
+ };
279
+ const formatDecimalIntegerValue = integerAsString => {
280
+ let result = "";
281
+ let i = 0;
282
+ for (; i < integerAsString.length - 3; i += 3) {
283
+ result += `${integerAsString.slice(i, i + 3)}${numericSeparator}`;
284
+ }
285
+ return i === 0 ? integerAsString : `${result}${integerAsString.slice(i)}`;
286
+ };
287
+ const formatNumberValue = value => {
288
+ if (Number.isNaN(value)) {
289
+ return "NaN";
290
+ }
291
+ if (value === Number.POSITIVE_INFINITY) {
292
+ return "+Infinity";
293
+ }
294
+ if (value === Number.NEGATIVE_INFINITY) {
295
+ return "-Infinity";
296
+ }
297
+ if (value === Number.EPSILON) {
298
+ return "Epsilon";
299
+ }
300
+ if (Object.is(value, -0)) {
301
+ return "-0";
302
+ }
303
+ const integer = Math.trunc(value);
304
+ const integerAsString = integer.toString();
305
+ if (integer === value) {
306
+ if (integerAsString.includes("e")) {
307
+ return integerAsString;
308
+ }
309
+ return formatIntegerValue(integerAsString);
310
+ } else {
311
+ return `${formatIntegerValue(integerAsString)}.${formatDecimalIntegerValue(String(value).slice(integerAsString.length + 1))}`;
312
+ }
313
+ };
259
314
  function internalFormatValue(value, styleFn, styles, {
260
315
  padding,
261
316
  depth,
@@ -264,27 +319,41 @@ function internalFormatValue(value, styleFn, styles, {
264
319
  }) {
265
320
  const typeofValue = typeof value;
266
321
  if (!styles) {
267
- if (value == null) {
268
- styles = ["cyan"];
322
+ if (value === null) {
323
+ styles = ["bold"];
269
324
  } else {
270
325
  switch (typeofValue) {
271
- case "undefined":
272
- styles = ["cyan"];
326
+ case "bigint":
327
+ styles = formatStyles.bigint;
273
328
  break;
274
329
  case "boolean":
275
- styles = ["green"];
330
+ styles = formatStyles.boolean;
276
331
  break;
277
- case "number":
278
- styles = ["yellow"];
332
+ case "undefined":
333
+ styles = formatStyles.undefined;
279
334
  break;
280
- case "bigint":
281
- styles = ["red"];
335
+ case "number":
336
+ styles = formatStyles.number;
282
337
  break;
283
338
  case "string":
284
- styles = ["orange"];
339
+ styles = formatStyles.string;
285
340
  break;
286
341
  case "symbol":
287
- styles = ["magenta"];
342
+ styles = formatStyles.symbol;
343
+ break;
344
+ case "object":
345
+ if (value instanceof Date) {
346
+ styles = formatStyles.date;
347
+ }
348
+ if (value instanceof RegExp) {
349
+ styles = formatStyles.regexp;
350
+ }
351
+ if (value instanceof Error) {
352
+ styles = formatStyles.error;
353
+ }
354
+ break;
355
+ case "function":
356
+ styles = formatStyles.function;
288
357
  break;
289
358
  }
290
359
  }
@@ -294,6 +363,8 @@ function internalFormatValue(value, styleFn, styles, {
294
363
  stringValue = "null";
295
364
  } else if (value === undefined) {
296
365
  stringValue = "undefined";
366
+ } else if (typeofValue === "number") {
367
+ stringValue = formatNumberValue(value);
297
368
  } else if (typeofValue === "boolean") {
298
369
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
299
370
  stringValue = value.toString();
@@ -335,7 +406,7 @@ function internalFormatValue(value, styleFn, styles, {
335
406
  });
336
407
  }
337
408
  } else if (typeofValue === "bigint") {
338
- stringValue = value.toString();
409
+ stringValue = `[BigInt: ${value.toString()}]`;
339
410
  } else if (typeofValue === "symbol") {
340
411
  stringValue = value.toString();
341
412
  } else if (value instanceof Set) {
@@ -354,6 +425,12 @@ function internalFormatValue(value, styleFn, styles, {
354
425
  stringValue = "{WeakMap...}";
355
426
  } else if (value instanceof WeakSet) {
356
427
  stringValue = "{WeakSet...}";
428
+ } else if (value instanceof Date) {
429
+ stringValue = `[Date: ${value.toISOString()}]`;
430
+ } else if (value instanceof RegExp) {
431
+ stringValue = `[RegExp: ${value.toString()}]`;
432
+ } else if (typeof value === "function") {
433
+ stringValue = `[Function: ${value.name}]`;
357
434
  } else {
358
435
  stringValue = tryStringify(value);
359
436
  }
@@ -367,7 +444,7 @@ const separator = ",";
367
444
  const internalFormatKey = (key, styleFn) => {
368
445
  return {
369
446
  stringKey: `${key}: `,
370
- formattedKey: `${styleFn(["gray-light", "bold"], `${key}:`)} `
447
+ formattedKey: `${styleFn(["dim", "bold"], `${key}:`)} `
371
448
  };
372
449
  };
373
450
  const internalNoKey = () => {
@@ -383,7 +460,7 @@ const internalFormatMapKey = (key, styleFn, internalFormatParams) => {
383
460
  } = internalFormatValue(key, noStyleFn, undefined, internalFormatParams);
384
461
  return {
385
462
  stringKey: `${stringValue} => `,
386
- formattedKey: `${styleFn(["gray-light", "bold"], `${formattedValue}:`)} `
463
+ formattedKey: `${styleFn(["dim", "bold"], `${formattedValue}:`)} `
387
464
  };
388
465
  };
389
466
  const internalFormatIterator = (values, styleFn, objectStyles, {
@@ -577,9 +654,9 @@ function formatObject(object, styleFn = noStyleFn, objectStyles, {
577
654
  function formatRecordToString(record, style) {
578
655
  const parts = [];
579
656
  if (record.displayName) {
580
- parts.push(style(["gray-light"], record.displayName));
657
+ parts.push(style(["dim"], record.displayName));
581
658
  } else if (record.key) {
582
- parts.push(style(["gray-light"], record.key));
659
+ parts.push(style(["dim"], record.key));
583
660
  }
584
661
  if (record.datetime) {
585
662
  parts.push(style(["gray", "bold"], record.datetime.toTimeString().split(" ", 2)[0]));
@@ -771,6 +848,7 @@ const ansiStyles = {
771
848
  cyan: ansi.cyan,
772
849
  white: ansi.white,
773
850
  gray: ansi.gray,
851
+ dim: ansi.dim,
774
852
  bgBlack: ansi.bgBlack,
775
853
  bgRed: ansi.bgRed,
776
854
  bgGreen: ansi.bgGreen,
@@ -785,10 +863,6 @@ const ansiStyles = {
785
863
  orange: {
786
864
  open: ansi.color.ansi256(ansi.hexToAnsi256(styleToHexColor.orange)),
787
865
  close: ansi.color.close
788
- },
789
- "gray-light": {
790
- open: ansi.color.ansi256(ansi.hexToAnsi256(styleToHexColor["gray-light"])),
791
- close: ansi.color.close
792
866
  }
793
867
  };
794
868
  function style$2(styles, string) {
@@ -988,11 +1062,18 @@ class LoggerCLI extends Logger {
988
1062
  }
989
1063
  group(name, fn) {
990
1064
  if (this.json) {
991
- fn();
1065
+ return fn();
992
1066
  } else {
993
1067
  console.group(name);
994
- fn();
995
- console.groupEnd();
1068
+ const result = fn();
1069
+ if (result instanceof Promise) {
1070
+ return result.finally(() => {
1071
+ console.groupEnd();
1072
+ });
1073
+ } else {
1074
+ console.groupEnd();
1075
+ return result;
1076
+ }
996
1077
  }
997
1078
  }
998
1079
  }
@@ -1016,5 +1097,5 @@ function listenUnhandledErrors(logger = new Logger("nightingale:listenUnhandledE
1016
1097
  });
1017
1098
  }
1018
1099
 
1019
- export { ANSIFormatter, BrowserConsoleFormatter, BrowserConsoleHandler, ConsoleCLIHandler, ConsoleHandler, HTMLFormatter, JSONFormatter, LoggerCLI, MarkdownFormatter, RawFormatter, StringHandler, addConfig, configure, consoleOutput, createFindDebugLevel, formatObject, formatRecordToString, levelToStyles, levelToSymbol, listenUnhandledErrors, styleToHexColor, styleToHtmlStyleThemeDark, styleToHtmlStyleThemeLight };
1100
+ export { ANSIFormatter, BrowserConsoleFormatter, BrowserConsoleHandler, ConsoleCLIHandler, ConsoleHandler, HTMLFormatter, JSONFormatter, LoggerCLI, MarkdownFormatter, RawFormatter, StringHandler, addConfig, configure, consoleOutput, createFindDebugLevel, formatObject, formatRecordToString, formatStyles, levelToStyles, levelToSymbol, listenUnhandledErrors, styleToHexColor, styleToHtmlStyleThemeDark, styleToHtmlStyleThemeLight };
1020
1101
  //# sourceMappingURL=index-browser.es.js.map