llmist 15.15.1 → 15.17.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/dist/index.cjs CHANGED
@@ -2295,6 +2295,8 @@ function createLogger(options = {}) {
2295
2295
  const defaultType = options.type ?? "pretty";
2296
2296
  const name = options.name ?? "llmist";
2297
2297
  const logReset = options.logReset ?? envLogReset ?? false;
2298
+ const envLogTee = parseEnvBoolean(process.env.LLMIST_LOG_TEE);
2299
+ const teeToConsole = options.teeToConsole ?? envLogTee ?? false;
2298
2300
  if (envLogFile && (!logFileInitialized || sharedLogFilePath !== envLogFile)) {
2299
2301
  try {
2300
2302
  if (sharedLogFileStream) {
@@ -2337,14 +2339,19 @@ function createLogger(options = {}) {
2337
2339
  // Use overwrite to redirect tslog's formatted output to file instead of console
2338
2340
  overwrite: useFileLogging ? {
2339
2341
  transportFormatted: (logMetaMarkup, logArgs, _logErrors) => {
2340
- if (!sharedLogFileStream) return;
2341
- const meta = stripAnsi(logMetaMarkup);
2342
2342
  const args = logArgs.map(
2343
- (arg) => typeof arg === "string" ? stripAnsi(arg) : JSON.stringify(arg)
2343
+ (arg) => typeof arg === "string" ? arg : JSON.stringify(arg)
2344
2344
  );
2345
- const line = `${meta}${args.join(" ")}
2346
- `;
2347
- sharedLogFileStream.write(line);
2345
+ if (sharedLogFileStream) {
2346
+ const meta = stripAnsi(logMetaMarkup);
2347
+ const fileArgs = args.map((a) => stripAnsi(a));
2348
+ sharedLogFileStream.write(`${meta}${fileArgs.join(" ")}
2349
+ `);
2350
+ }
2351
+ if (teeToConsole) {
2352
+ process.stdout.write(`${logMetaMarkup}${args.join(" ")}
2353
+ `);
2354
+ }
2348
2355
  }
2349
2356
  } : void 0
2350
2357
  });