@sprucelabs/spruce-skill-utils 31.2.16 → 31.2.18

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.
@@ -58,8 +58,8 @@ export default function buildLog(prefix = undefined, options) {
58
58
  return t;
59
59
  }
60
60
  function write(chalkMethod, rawArgs, level) {
61
- var _a, _b, _c, _d, _e;
62
- if (!shouldWrite(process.env.LOG_LEVEL, level)) {
61
+ var _a, _b, _c, _d, _e, _f, _g, _h;
62
+ if (!shouldWrite((_c = (_b = (_a = getProcess()) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.LOG_LEVEL) !== null && _c !== void 0 ? _c : undefined, level)) {
63
63
  return '';
64
64
  }
65
65
  const args = rawArgs.map((a) => { var _a, _b; return (_b = (_a = a === null || a === void 0 ? void 0 : a.toString) === null || _a === void 0 ? void 0 : _a.call(a)) !== null && _b !== void 0 ? _b : 'undefined'; });
@@ -83,7 +83,7 @@ export default function buildLog(prefix = undefined, options) {
83
83
  }
84
84
  return prefix;
85
85
  }
86
- const env = (_b = (_a = getProcess()) === null || _a === void 0 ? void 0 : _a.env) !== null && _b !== void 0 ? _b : {};
86
+ const env = (_e = (_d = getProcess()) === null || _d === void 0 ? void 0 : _d.env) !== null && _e !== void 0 ? _e : {};
87
87
  let logMethod = 'log';
88
88
  switch (level) {
89
89
  case 'ERROR':
@@ -96,12 +96,12 @@ export default function buildLog(prefix = undefined, options) {
96
96
  logMethod = 'log';
97
97
  break;
98
98
  }
99
- const transport = log !== null && log !== void 0 ? log : (level === 'ERROR' && ((_d = (_c = getProcess()) === null || _c === void 0 ? void 0 : _c.stderr) === null || _d === void 0 ? void 0 : _d.write)
99
+ const transport = log !== null && log !== void 0 ? log : (level === 'ERROR' && ((_g = (_f = getProcess()) === null || _f === void 0 ? void 0 : _f.stderr) === null || _g === void 0 ? void 0 : _g.write)
100
100
  ? (...args) => {
101
101
  var _a;
102
102
  (_a = getProcess()) === null || _a === void 0 ? void 0 : _a.stderr.write(args.join(' ') + '\n');
103
103
  }
104
- : ((_e = console[logMethod]) !== null && _e !== void 0 ? _e : console.log).bind(console));
104
+ : ((_h = console[logMethod]) !== null && _h !== void 0 ? _h : console.log).bind(console));
105
105
  let message = shouldUseColors === false
106
106
  ? `(${level})${prefix}`
107
107
  : chalkMethod(...chalkArgs);
@@ -134,7 +134,7 @@ export const stubLog = buildLog('STUB', {
134
134
  useColors: false,
135
135
  });
136
136
  function shouldWrite(maxLogLevel, level) {
137
- if (process.env.LOG_LEVEL) {
137
+ if (maxLogLevel) {
138
138
  if (process.env.LOG_LEVEL == 'none') {
139
139
  return false;
140
140
  }
@@ -64,7 +64,7 @@ function buildLog(prefix = undefined, options) {
64
64
  return t;
65
65
  }
66
66
  function write(chalkMethod, rawArgs, level) {
67
- if (!shouldWrite(process.env.LOG_LEVEL, level)) {
67
+ if (!shouldWrite(getProcess()?.env?.LOG_LEVEL ?? undefined, level)) {
68
68
  return '';
69
69
  }
70
70
  const args = rawArgs.map((a) => a?.toString?.() ?? 'undefined');
@@ -138,7 +138,7 @@ exports.stubLog = buildLog('STUB', {
138
138
  useColors: false,
139
139
  });
140
140
  function shouldWrite(maxLogLevel, level) {
141
- if (process.env.LOG_LEVEL) {
141
+ if (maxLogLevel) {
142
142
  if (process.env.LOG_LEVEL == 'none') {
143
143
  return false;
144
144
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "31.2.16",
6
+ "version": "31.2.18",
7
7
  "skill": {
8
8
  "namespace": "skill-utils",
9
9
  "upgradeIgnoreList": [