@storm-software/config-tools 1.40.0 → 1.41.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/config-tools",
3
- "version": "1.40.0",
3
+ "version": "1.41.0",
4
4
  "private": false,
5
5
  "description": "⚡The Storm-Ops monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.",
6
6
  "repository": {
@@ -1579,6 +1579,7 @@ var require_source = __commonJS({
1579
1579
  // packages/config-tools/src/utilities/logger.ts
1580
1580
  var logger_exports = {};
1581
1581
  __export(logger_exports, {
1582
+ formatLogMessage: () => formatLogMessage,
1582
1583
  getLogFn: () => getLogFn,
1583
1584
  getStopwatch: () => getStopwatch,
1584
1585
  writeDebug: () => writeDebug,
@@ -5566,7 +5567,9 @@ var getLogFn = (logLevel = LogLevel.INFO, config = {}) => {
5566
5567
  return (message) => {
5567
5568
  console.error(
5568
5569
  `
5569
- ${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.fatal).whiteBright(" \u{1F480} Fatal ")} ${_chalk.hex(colors.error)(message)}
5570
+ ${_chalk.bold.hex(colors.error ?? "#f85149")(">")} ${_chalk.bold.bgHex(colors.fatal ?? "#b62324").whiteBright(
5571
+ " \u{1F480} Fatal "
5572
+ )} ${_chalk.hex(colors.error ?? "#f85149")(formatLogMessage(message))}
5570
5573
 
5571
5574
  `
5572
5575
  );
@@ -5576,7 +5579,9 @@ ${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.fatal).whiteBri
5576
5579
  return (message) => {
5577
5580
  console.error(
5578
5581
  `
5579
- ${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.error).whiteBright(" \u2718 Error ")} ${_chalk.hex(colors.error)(message)}
5582
+ ${_chalk.bold.hex(colors.error ?? "#f85149")(">")} ${_chalk.bold.bgHex(colors.error ?? "#f85149").whiteBright(
5583
+ " \u2718 Error "
5584
+ )} ${_chalk.hex(colors.error ?? "#f85149")(formatLogMessage(message))}
5580
5585
  `
5581
5586
  );
5582
5587
  };
@@ -5585,7 +5590,9 @@ ${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.error).whiteBri
5585
5590
  return (message) => {
5586
5591
  console.warn(
5587
5592
  `
5588
- ${_chalk.bold.hex(colors.warning)("> ")} ${_chalk.bold.bgHex(colors.warning).whiteBright(" \u26A0 Warn ")} ${_chalk.hex(colors.warning)(message)}
5593
+ ${_chalk.bold.hex(colors.warning ?? "#e3b341")("> ")} ${_chalk.bold.bgHex(colors.warning ?? "#e3b341").whiteBright(
5594
+ " \u26A0 Warn "
5595
+ )} ${_chalk.hex(colors.warning ?? "#e3b341")(formatLogMessage(message))}
5589
5596
  `
5590
5597
  );
5591
5598
  };
@@ -5594,7 +5601,9 @@ ${_chalk.bold.hex(colors.warning)("> ")} ${_chalk.bold.bgHex(colors.warning).whi
5594
5601
  return (message) => {
5595
5602
  console.info(
5596
5603
  `
5597
- ${_chalk.bold.hex(colors.success)(">")} ${_chalk.bold.bgHex(colors.success).whiteBright(" \u2713 Success ")} ${_chalk.hex(colors.success)(message)}
5604
+ ${_chalk.bold.hex(colors.success ?? "#56d364")(">")} ${_chalk.bold.bgHex(colors.success ?? "#56d364").whiteBright(
5605
+ " \u2713 Success "
5606
+ )} ${_chalk.hex(colors.success ?? "#56d364")(formatLogMessage(message))}
5598
5607
  `
5599
5608
  );
5600
5609
  };
@@ -5603,7 +5612,9 @@ ${_chalk.bold.hex(colors.success)(">")} ${_chalk.bold.bgHex(colors.success).whit
5603
5612
  return (message) => {
5604
5613
  console.info(
5605
5614
  `
5606
- ${_chalk.bold.hex(colors.info)(">")} ${_chalk.bold.bgHex(colors.info).whiteBright(" \u2139 Info ")} ${_chalk.hex(colors.info)(message)}
5615
+ ${_chalk.bold.hex(colors.info ?? "#58a6ff")(">")} ${_chalk.bold.bgHex(colors.info ?? "#58a6ff").whiteBright(
5616
+ " \u2139 Info "
5617
+ )} ${_chalk.hex(colors.info ?? "#58a6ff")(formatLogMessage(message))}
5607
5618
  `
5608
5619
  );
5609
5620
  };
@@ -5612,7 +5623,9 @@ ${_chalk.bold.hex(colors.info)(">")} ${_chalk.bold.bgHex(colors.info).whiteBrigh
5612
5623
  return (message) => {
5613
5624
  console.debug(
5614
5625
  `
5615
- ${_chalk.bold.hex(colors.primary)(">")} ${_chalk.bold.bgHex(colors.primary).whiteBright(" \u{1F6E0} Debug ")} ${_chalk.hex(colors.primary)(message)}
5626
+ ${_chalk.bold.hex(colors.primary ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.primary ?? "#1fb2a6").whiteBright(
5627
+ " \u{1F6E0} Debug "
5628
+ )} ${_chalk.hex(colors.primary ?? "#1fb2a6")(formatLogMessage(message))}
5616
5629
  `
5617
5630
  );
5618
5631
  };
@@ -5620,7 +5633,9 @@ ${_chalk.bold.hex(colors.primary)(">")} ${_chalk.bold.bgHex(colors.primary).whit
5620
5633
  return (message) => {
5621
5634
  console.log(
5622
5635
  `
5623
- ${_chalk.bold.hex(colors.primary)(">")} ${_chalk.bold.bgHex(colors.primary).whiteBright(" \u2709 System ")} ${_chalk.hex(colors.primary)(message)}
5636
+ ${_chalk.bold.hex(colors.primary ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.primary ?? "#1fb2a6").whiteBright(
5637
+ " \u2709 System "
5638
+ )} ${_chalk.hex(colors.primary ?? "#1fb2a6")(formatLogMessage(message))}
5624
5639
  `
5625
5640
  );
5626
5641
  };
@@ -5647,8 +5662,22 @@ var getStopwatch = (name) => {
5647
5662
  );
5648
5663
  };
5649
5664
  };
5665
+ var formatLogMessage = (message, prefix = "-") => {
5666
+ return typeof message === "string" ? message : typeof message === "object" ? Object.keys(message).map(
5667
+ (key) => ` ${prefix} ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? `
5668
+ ${formatLogMessage(message[key], `${prefix}-`)}` : message[key]}`
5669
+ ).join("\n") : message;
5670
+ };
5671
+ var _isFunction = (value) => {
5672
+ try {
5673
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
5674
+ } catch (e) {
5675
+ return false;
5676
+ }
5677
+ };
5650
5678
  // Annotate the CommonJS export names for ESM import in node:
5651
5679
  0 && (module.exports = {
5680
+ formatLogMessage,
5652
5681
  getLogFn,
5653
5682
  getStopwatch,
5654
5683
  writeDebug,
@@ -5552,7 +5552,9 @@ var getLogFn = (logLevel = LogLevel.INFO, config = {}) => {
5552
5552
  return (message) => {
5553
5553
  console.error(
5554
5554
  `
5555
- ${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.fatal).whiteBright(" \u{1F480} Fatal ")} ${_chalk.hex(colors.error)(message)}
5555
+ ${_chalk.bold.hex(colors.error ?? "#f85149")(">")} ${_chalk.bold.bgHex(colors.fatal ?? "#b62324").whiteBright(
5556
+ " \u{1F480} Fatal "
5557
+ )} ${_chalk.hex(colors.error ?? "#f85149")(formatLogMessage(message))}
5556
5558
 
5557
5559
  `
5558
5560
  );
@@ -5562,7 +5564,9 @@ ${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.fatal).whiteBri
5562
5564
  return (message) => {
5563
5565
  console.error(
5564
5566
  `
5565
- ${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.error).whiteBright(" \u2718 Error ")} ${_chalk.hex(colors.error)(message)}
5567
+ ${_chalk.bold.hex(colors.error ?? "#f85149")(">")} ${_chalk.bold.bgHex(colors.error ?? "#f85149").whiteBright(
5568
+ " \u2718 Error "
5569
+ )} ${_chalk.hex(colors.error ?? "#f85149")(formatLogMessage(message))}
5566
5570
  `
5567
5571
  );
5568
5572
  };
@@ -5571,7 +5575,9 @@ ${_chalk.bold.hex(colors.error)(">")} ${_chalk.bold.bgHex(colors.error).whiteBri
5571
5575
  return (message) => {
5572
5576
  console.warn(
5573
5577
  `
5574
- ${_chalk.bold.hex(colors.warning)("> ")} ${_chalk.bold.bgHex(colors.warning).whiteBright(" \u26A0 Warn ")} ${_chalk.hex(colors.warning)(message)}
5578
+ ${_chalk.bold.hex(colors.warning ?? "#e3b341")("> ")} ${_chalk.bold.bgHex(colors.warning ?? "#e3b341").whiteBright(
5579
+ " \u26A0 Warn "
5580
+ )} ${_chalk.hex(colors.warning ?? "#e3b341")(formatLogMessage(message))}
5575
5581
  `
5576
5582
  );
5577
5583
  };
@@ -5580,7 +5586,9 @@ ${_chalk.bold.hex(colors.warning)("> ")} ${_chalk.bold.bgHex(colors.warning).whi
5580
5586
  return (message) => {
5581
5587
  console.info(
5582
5588
  `
5583
- ${_chalk.bold.hex(colors.success)(">")} ${_chalk.bold.bgHex(colors.success).whiteBright(" \u2713 Success ")} ${_chalk.hex(colors.success)(message)}
5589
+ ${_chalk.bold.hex(colors.success ?? "#56d364")(">")} ${_chalk.bold.bgHex(colors.success ?? "#56d364").whiteBright(
5590
+ " \u2713 Success "
5591
+ )} ${_chalk.hex(colors.success ?? "#56d364")(formatLogMessage(message))}
5584
5592
  `
5585
5593
  );
5586
5594
  };
@@ -5589,7 +5597,9 @@ ${_chalk.bold.hex(colors.success)(">")} ${_chalk.bold.bgHex(colors.success).whit
5589
5597
  return (message) => {
5590
5598
  console.info(
5591
5599
  `
5592
- ${_chalk.bold.hex(colors.info)(">")} ${_chalk.bold.bgHex(colors.info).whiteBright(" \u2139 Info ")} ${_chalk.hex(colors.info)(message)}
5600
+ ${_chalk.bold.hex(colors.info ?? "#58a6ff")(">")} ${_chalk.bold.bgHex(colors.info ?? "#58a6ff").whiteBright(
5601
+ " \u2139 Info "
5602
+ )} ${_chalk.hex(colors.info ?? "#58a6ff")(formatLogMessage(message))}
5593
5603
  `
5594
5604
  );
5595
5605
  };
@@ -5598,7 +5608,9 @@ ${_chalk.bold.hex(colors.info)(">")} ${_chalk.bold.bgHex(colors.info).whiteBrigh
5598
5608
  return (message) => {
5599
5609
  console.debug(
5600
5610
  `
5601
- ${_chalk.bold.hex(colors.primary)(">")} ${_chalk.bold.bgHex(colors.primary).whiteBright(" \u{1F6E0} Debug ")} ${_chalk.hex(colors.primary)(message)}
5611
+ ${_chalk.bold.hex(colors.primary ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.primary ?? "#1fb2a6").whiteBright(
5612
+ " \u{1F6E0} Debug "
5613
+ )} ${_chalk.hex(colors.primary ?? "#1fb2a6")(formatLogMessage(message))}
5602
5614
  `
5603
5615
  );
5604
5616
  };
@@ -5606,7 +5618,9 @@ ${_chalk.bold.hex(colors.primary)(">")} ${_chalk.bold.bgHex(colors.primary).whit
5606
5618
  return (message) => {
5607
5619
  console.log(
5608
5620
  `
5609
- ${_chalk.bold.hex(colors.primary)(">")} ${_chalk.bold.bgHex(colors.primary).whiteBright(" \u2709 System ")} ${_chalk.hex(colors.primary)(message)}
5621
+ ${_chalk.bold.hex(colors.primary ?? "#1fb2a6")(">")} ${_chalk.bold.bgHex(colors.primary ?? "#1fb2a6").whiteBright(
5622
+ " \u2709 System "
5623
+ )} ${_chalk.hex(colors.primary ?? "#1fb2a6")(formatLogMessage(message))}
5610
5624
  `
5611
5625
  );
5612
5626
  };
@@ -5633,7 +5647,21 @@ var getStopwatch = (name) => {
5633
5647
  );
5634
5648
  };
5635
5649
  };
5650
+ var formatLogMessage = (message, prefix = "-") => {
5651
+ return typeof message === "string" ? message : typeof message === "object" ? Object.keys(message).map(
5652
+ (key) => ` ${prefix} ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? `
5653
+ ${formatLogMessage(message[key], `${prefix}-`)}` : message[key]}`
5654
+ ).join("\n") : message;
5655
+ };
5656
+ var _isFunction = (value) => {
5657
+ try {
5658
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
5659
+ } catch (e) {
5660
+ return false;
5661
+ }
5662
+ };
5636
5663
  export {
5664
+ formatLogMessage,
5637
5665
  getLogFn,
5638
5666
  getStopwatch,
5639
5667
  writeDebug,