diff --git a/fern/pages/changelogs/cli/2025-01-19.mdx b/fern/pages/changelogs/cli/2025-01-19.mdx index 77fa640cad0..9aa1bf08b39 100644 --- a/fern/pages/changelogs/cli/2025-01-19.mdx +++ b/fern/pages/changelogs/cli/2025-01-19.mdx @@ -1,6 +1,3 @@ -## 0.50.10 -**`(fix):`** An addition to the broken link checker to further reduce false positives. - ## 0.50.9 **`(fix):`** The Fern CLI no longer logs the full API request when finishing docs registration, reducing unnecessary log output. diff --git a/generators/browser-compatible-base/src/AbstractGeneratorContext.ts b/generators/browser-compatible-base/src/AbstractGeneratorContext.ts index 78e9ff572f3..cdc7016198e 100644 --- a/generators/browser-compatible-base/src/AbstractGeneratorContext.ts +++ b/generators/browser-compatible-base/src/AbstractGeneratorContext.ts @@ -4,6 +4,7 @@ import { FernGeneratorExec, GeneratorNotificationService } from "./GeneratorNoti import { getSdkVersion } from "./utils"; const LOG_LEVEL_CONVERSIONS: Record = { + [LogLevel.Trace]: FernGeneratorExec.logging.LogLevel.Debug, [LogLevel.Debug]: FernGeneratorExec.logging.LogLevel.Debug, [LogLevel.Info]: FernGeneratorExec.logging.LogLevel.Info, [LogLevel.Warn]: FernGeneratorExec.logging.LogLevel.Warn, diff --git a/generators/typescript/utils/abstract-generator-cli/src/AbstractGeneratorCli.ts b/generators/typescript/utils/abstract-generator-cli/src/AbstractGeneratorCli.ts index d39f1f1090e..d9cc6a86bd2 100644 --- a/generators/typescript/utils/abstract-generator-cli/src/AbstractGeneratorCli.ts +++ b/generators/typescript/utils/abstract-generator-cli/src/AbstractGeneratorCli.ts @@ -19,6 +19,7 @@ import { writeGitHubWorkflows } from "./writeGitHubWorkflows"; const OUTPUT_ZIP_FILENAME = "output.zip"; const LOG_LEVEL_CONVERSIONS: Record = { + [LogLevel.Trace]: FernGeneratorExec.logging.LogLevel.Debug, [LogLevel.Debug]: FernGeneratorExec.logging.LogLevel.Debug, [LogLevel.Info]: FernGeneratorExec.logging.LogLevel.Info, [LogLevel.Warn]: FernGeneratorExec.logging.LogLevel.Warn, diff --git a/packages/cli/cli/src/cli-context/TtyAwareLogger.ts b/packages/cli/cli/src/cli-context/TtyAwareLogger.ts index 6266cb7bc2d..973686cd1b0 100644 --- a/packages/cli/cli/src/cli-context/TtyAwareLogger.ts +++ b/packages/cli/cli/src/cli-context/TtyAwareLogger.ts @@ -168,6 +168,7 @@ function formatLog(log: Log, { includeDebugInfo }: { includeDebugInfo: boolean } case LogLevel.Warn: return chalk.hex("FFA500")(content); case LogLevel.Debug: + case LogLevel.Trace: case LogLevel.Info: return content; } @@ -188,6 +189,8 @@ function getLogLevelAsString(logLevel: LogLevel) { return "WARN"; case LogLevel.Error: return "ERROR"; + case LogLevel.Trace: + return "TRACE"; default: assertNever(logLevel); } diff --git a/packages/cli/cli/src/cli.ts b/packages/cli/cli/src/cli.ts index c97a7b7b7bb..42791f08ff1 100644 --- a/packages/cli/cli/src/cli.ts +++ b/packages/cli/cli/src/cli.ts @@ -62,7 +62,7 @@ async function runCli() { if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { const { setGlobalDispatcher, Agent } = await import("undici"); - setGlobalDispatcher(new Agent({ connect: { timeout: 5_000 } })); + setGlobalDispatcher(new Agent({ connect: { timeout: 5_000 }, bodyTimeout: 0, headersTimeout: 6_000 })); } // eslint-disable-next-line @typescript-eslint/no-misused-promises diff --git a/packages/cli/cli/versions.yml b/packages/cli/cli/versions.yml index 33619c9fca0..6118124e6fa 100644 --- a/packages/cli/cli/versions.yml +++ b/packages/cli/cli/versions.yml @@ -1,5 +1,13 @@ - changelogEntry: - summary: | + The CLI now supports a `--log-level trace` option to filter out noise from the + debug log level. + type: fix + irVersion: 55 + version: 0.50.11 + +- changelogEntry: + - summary: An addition to the broken link checker to further reduce false positives. type: fix irVersion: 55 diff --git a/packages/cli/docs-resolver/src/ApiDefinitionHolder.ts b/packages/cli/docs-resolver/src/ApiDefinitionHolder.ts index 5001d80e642..047dcc1f910 100644 --- a/packages/cli/docs-resolver/src/ApiDefinitionHolder.ts +++ b/packages/cli/docs-resolver/src/ApiDefinitionHolder.ts @@ -122,7 +122,7 @@ export class ApiDefinitionHolder { }); locators.forEach((locator) => { - this.context?.logger.debug(`Registering endpoint locator: ${locator}`); + this.context?.logger.trace(`Registering endpoint locator: ${locator}`); this.#endpointsByLocator.set(locator, endpoint); }); }); @@ -164,7 +164,7 @@ export class ApiDefinitionHolder { }); locators.forEach((locator) => { - this.context?.logger.debug(`Registering websocket locator: ${locator}`); + this.context?.logger.trace(`Registering websocket locator: ${locator}`); this.#webSocketsByLocator.set(locator, webSocket); }); }); @@ -199,7 +199,7 @@ export class ApiDefinitionHolder { const path = packageList.length === 0 ? [ROOT_PACKAGE_ID] : packageList; const locators = [path.join("."), path.join("/"), `${path.join(".")}.yml`]; locators.forEach((locator) => { - this.context?.logger.debug(`Registering subpackage locator: ${locator}`); + this.context?.logger.trace(`Registering subpackage locator: ${locator}`); this.#subpackagesByLocator.set(locator, pkg); }); @@ -211,7 +211,7 @@ export class ApiDefinitionHolder { const path = [...packageList, endpoint.id]; const locators = [path.join("."), path.join("/")]; locators.forEach((locator) => { - this.context?.logger.debug(`Registering endpoint locator: ${locator}`); + this.context?.logger.trace(`Registering endpoint locator: ${locator}`); this.#endpointsByLocator.set(locator, endpoint); }); }); @@ -220,7 +220,7 @@ export class ApiDefinitionHolder { const path = [...packageList, webSocket.id]; const locators = [path.join("."), path.join("/")]; locators.forEach((locator) => { - this.context?.logger.debug(`Registering websocket locator: ${locator}`); + this.context?.logger.trace(`Registering websocket locator: ${locator}`); this.#webSocketsByLocator.set(locator, webSocket); }); }); @@ -229,7 +229,7 @@ export class ApiDefinitionHolder { const path = [...packageList, webhook.id]; const locators = [path.join("."), path.join("/")]; locators.forEach((locator) => { - this.context?.logger.debug(`Registering webhook locator: ${locator}`); + this.context?.logger.trace(`Registering webhook locator: ${locator}`); this.#webhooksByLocator.set(locator, webhook); }); }); diff --git a/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocs.ts b/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocs.ts index ae0a3362646..ffa1594a591 100644 --- a/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocs.ts +++ b/packages/cli/generation/remote-generation/remote-workspace-runner/src/publishDocs.ts @@ -236,6 +236,9 @@ export async function publishDocs({ CjsFdrSdk.docs.v1.write.DocsRegistrationId(docsRegistrationId), { docsDefinition + }, + { + timeoutInSeconds: 600 } ); diff --git a/packages/cli/logger/src/LogLevel.ts b/packages/cli/logger/src/LogLevel.ts index ddb5d2e3973..ae1c884e8b1 100644 --- a/packages/cli/logger/src/LogLevel.ts +++ b/packages/cli/logger/src/LogLevel.ts @@ -4,7 +4,8 @@ export const LogLevel = { Debug: "debug", Info: "info", Warn: "warn", - Error: "error" + Error: "error", + Trace: "trace" } as const; export type LogLevel = Values; diff --git a/packages/cli/logger/src/Logger.ts b/packages/cli/logger/src/Logger.ts index 1a7dc5f9ff5..3fc9b38c5f6 100644 --- a/packages/cli/logger/src/Logger.ts +++ b/packages/cli/logger/src/Logger.ts @@ -3,6 +3,7 @@ import { LogLevel } from "./LogLevel"; export interface Logger { disable: () => void; enable: () => void; + trace: (...args: string[]) => void; debug: (...args: string[]) => void; info: (...args: string[]) => void; warn: (...args: string[]) => void; diff --git a/packages/cli/logger/src/console.ts b/packages/cli/logger/src/console.ts index 068fb0dcbf3..f98140f15c1 100644 --- a/packages/cli/logger/src/console.ts +++ b/packages/cli/logger/src/console.ts @@ -11,6 +11,9 @@ function log(level: LogLevel, ...args: string[]): void { function getConsoleLoggerForLevel(level: LogLevel): (...args: string[]) => void { switch (level) { + case LogLevel.Trace: + // eslint-disable-next-line no-console + return console.trace; case LogLevel.Debug: // eslint-disable-next-line no-console return console.debug; diff --git a/packages/cli/logger/src/createLogger.ts b/packages/cli/logger/src/createLogger.ts index e7ba62e0456..2b6777d619a 100644 --- a/packages/cli/logger/src/createLogger.ts +++ b/packages/cli/logger/src/createLogger.ts @@ -38,6 +38,12 @@ class LoggerImpl implements Logger { this.log(LogLevel.Error, ...args); } } + + public trace(...args: string[]): void { + if (this.enabled) { + this.log(LogLevel.Trace, ...args); + } + } } export function createLogger(log: (level: LogLevel, ...args: string[]) => void): Logger { diff --git a/packages/seed/src/commands/test/TaskContextFactory.ts b/packages/seed/src/commands/test/TaskContextFactory.ts index d2b7bd6df4c..70f78648d62 100644 --- a/packages/seed/src/commands/test/TaskContextFactory.ts +++ b/packages/seed/src/commands/test/TaskContextFactory.ts @@ -38,6 +38,9 @@ export class TaskContextFactory { case "info": CONSOLE_LOGGER.info(`[${prefixWithColor}]: `, part); break; + case "trace": + CONSOLE_LOGGER.trace(`[${prefixWithColor}]: `, part); + break; default: assertNever(log.level); } diff --git a/packages/snippets/core/src/utils/NopLogger.ts b/packages/snippets/core/src/utils/NopLogger.ts index a805fa7c353..1953ddac1b9 100644 --- a/packages/snippets/core/src/utils/NopLogger.ts +++ b/packages/snippets/core/src/utils/NopLogger.ts @@ -1,4 +1,4 @@ -export type LogLevel = "debug" | "info" | "warn" | "error"; +export type LogLevel = "debug" | "info" | "warn" | "error" | "trace"; export class NopLogger { public disable(): void { @@ -9,6 +9,10 @@ export class NopLogger { // no-op } + public trace(...args: string[]): void { + // no-op + } + public debug(...args: string[]): void { // no-op }