scenv 0.6.0 → 0.6.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/index.cjs +34 -7
- package/dist/index.js +34 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -257,16 +257,43 @@ var configLoadedLogged = false;
|
|
|
257
257
|
function resetLogState() {
|
|
258
258
|
configLoadedLogged = false;
|
|
259
259
|
}
|
|
260
|
+
var CONFIG_LOG_KEYS = [
|
|
261
|
+
"root",
|
|
262
|
+
"context",
|
|
263
|
+
"prompt",
|
|
264
|
+
"ignoreEnv",
|
|
265
|
+
"ignoreContext",
|
|
266
|
+
"set",
|
|
267
|
+
"shouldSavePrompt",
|
|
268
|
+
"saveContextTo",
|
|
269
|
+
"contextDir",
|
|
270
|
+
"logLevel"
|
|
271
|
+
];
|
|
272
|
+
function configForLog(config) {
|
|
273
|
+
return Object.fromEntries(
|
|
274
|
+
CONFIG_LOG_KEYS.filter((k) => config[k] !== void 0).map((k) => [k, config[k]])
|
|
275
|
+
);
|
|
276
|
+
}
|
|
260
277
|
function logConfigLoaded(config) {
|
|
261
278
|
if (configLoadedLogged) return;
|
|
262
|
-
if (getLevelNum() < LEVEL_NUM.info) return;
|
|
263
279
|
configLoadedLogged = true;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
280
|
+
const levelNum = LEVEL_NUM[config.logLevel ?? "none"];
|
|
281
|
+
if (levelNum >= LEVEL_NUM.info) {
|
|
282
|
+
const parts = [
|
|
283
|
+
"root=" + (config.root ?? "(cwd)"),
|
|
284
|
+
"context=" + JSON.stringify(config.context ?? [])
|
|
285
|
+
];
|
|
286
|
+
if (config.prompt !== void 0) parts.push("prompt=" + config.prompt);
|
|
287
|
+
if (config.ignoreEnv === true) parts.push("ignoreEnv=true");
|
|
288
|
+
if (config.ignoreContext === true) parts.push("ignoreContext=true");
|
|
289
|
+
if (config.saveContextTo !== void 0) parts.push("saveContextTo=" + config.saveContextTo);
|
|
290
|
+
if (config.contextDir !== void 0) parts.push("contextDir=" + config.contextDir);
|
|
291
|
+
if (config.shouldSavePrompt !== void 0) parts.push("shouldSavePrompt=" + config.shouldSavePrompt);
|
|
292
|
+
log("info", "config loaded", parts.join(" "));
|
|
293
|
+
}
|
|
294
|
+
if (levelNum >= LEVEL_NUM.debug) {
|
|
295
|
+
log("debug", "config (full)", JSON.stringify(configForLog(config)));
|
|
296
|
+
}
|
|
270
297
|
}
|
|
271
298
|
function log(level, msg, ...args) {
|
|
272
299
|
const configured = getLevelNum();
|
package/dist/index.js
CHANGED
|
@@ -221,16 +221,43 @@ var configLoadedLogged = false;
|
|
|
221
221
|
function resetLogState() {
|
|
222
222
|
configLoadedLogged = false;
|
|
223
223
|
}
|
|
224
|
+
var CONFIG_LOG_KEYS = [
|
|
225
|
+
"root",
|
|
226
|
+
"context",
|
|
227
|
+
"prompt",
|
|
228
|
+
"ignoreEnv",
|
|
229
|
+
"ignoreContext",
|
|
230
|
+
"set",
|
|
231
|
+
"shouldSavePrompt",
|
|
232
|
+
"saveContextTo",
|
|
233
|
+
"contextDir",
|
|
234
|
+
"logLevel"
|
|
235
|
+
];
|
|
236
|
+
function configForLog(config) {
|
|
237
|
+
return Object.fromEntries(
|
|
238
|
+
CONFIG_LOG_KEYS.filter((k) => config[k] !== void 0).map((k) => [k, config[k]])
|
|
239
|
+
);
|
|
240
|
+
}
|
|
224
241
|
function logConfigLoaded(config) {
|
|
225
242
|
if (configLoadedLogged) return;
|
|
226
|
-
if (getLevelNum() < LEVEL_NUM.info) return;
|
|
227
243
|
configLoadedLogged = true;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
244
|
+
const levelNum = LEVEL_NUM[config.logLevel ?? "none"];
|
|
245
|
+
if (levelNum >= LEVEL_NUM.info) {
|
|
246
|
+
const parts = [
|
|
247
|
+
"root=" + (config.root ?? "(cwd)"),
|
|
248
|
+
"context=" + JSON.stringify(config.context ?? [])
|
|
249
|
+
];
|
|
250
|
+
if (config.prompt !== void 0) parts.push("prompt=" + config.prompt);
|
|
251
|
+
if (config.ignoreEnv === true) parts.push("ignoreEnv=true");
|
|
252
|
+
if (config.ignoreContext === true) parts.push("ignoreContext=true");
|
|
253
|
+
if (config.saveContextTo !== void 0) parts.push("saveContextTo=" + config.saveContextTo);
|
|
254
|
+
if (config.contextDir !== void 0) parts.push("contextDir=" + config.contextDir);
|
|
255
|
+
if (config.shouldSavePrompt !== void 0) parts.push("shouldSavePrompt=" + config.shouldSavePrompt);
|
|
256
|
+
log("info", "config loaded", parts.join(" "));
|
|
257
|
+
}
|
|
258
|
+
if (levelNum >= LEVEL_NUM.debug) {
|
|
259
|
+
log("debug", "config (full)", JSON.stringify(configForLog(config)));
|
|
260
|
+
}
|
|
234
261
|
}
|
|
235
262
|
function log(level, msg, ...args) {
|
|
236
263
|
const configured = getLevelNum();
|