From 4822b8179c212c8701ef49b06e70f52c77e075a9 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Fri, 27 Jun 2025 13:35:44 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`dev`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @warengonzaga. * https://github.com/wgtechlabs/log-engine/pull/16#issuecomment-3013095669 The following files were modified: * `src/logger/advanced-outputs.ts` --- src/logger/advanced-outputs.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/logger/advanced-outputs.ts b/src/logger/advanced-outputs.ts index 454c611..1b535fa 100644 --- a/src/logger/advanced-outputs.ts +++ b/src/logger/advanced-outputs.ts @@ -266,7 +266,18 @@ export class HttpOutputHandler { } /** - * Factory function to create built-in output handlers + * Returns a logging handler function based on the specified type and configuration. + * + * Supported types are: + * - `'console'`: Logs to the console using the appropriate method for the log level. + * - `'silent'`: Returns a no-op handler that discards all logs. + * - `'file'`: Writes logs to a file with optional rotation; requires `filePath` in config. + * - `'http'`: Sends logs to a remote HTTP endpoint; requires `url` in config. + * + * If required configuration is missing or initialization fails, logs an error and returns either a fallback handler or `null`. + * + * @param type - The type of output handler to create (`'console'`, `'silent'`, `'file'`, or `'http'`) + * @returns A log handler function or `null` if the handler cannot be created */ export function createBuiltInHandler(type: string, config?: any): ((level: string, message: string, data?: unknown) => void) | null { switch (type) {