import InteractiveManager from "./interactive/interactive-manager.d.ts"; import { PailBrowserImpl } from "./pail.d.ts"; import type { MultiBarOptions, SingleBarOptions } from "./progress-bar.d.ts"; import { MultiProgressBar, ProgressBar } from "./progress-bar.d.ts"; import type { SpinnerOptions } from "./spinner.d.ts"; import { MultiSpinner, Spinner } from "./spinner.d.ts"; import type { ConstructorOptions, DefaultLogTypes, LoggerFunction, Reporter, ServerConstructorOptions } from "./types.d.ts"; declare class PailServerImpl extends PailBrowserImpl { #private; readonly options: ServerConstructorOptions; protected readonly stdout: NodeJS.WriteStream; protected readonly stderr: NodeJS.WriteStream; protected interactiveManager: InteractiveManager | undefined; protected readonly interactive: boolean; /** * Creates a new Pail server logger instance. * * Initializes the server-compatible logger with streams, interactive support, * and server-specific configuration options. * @param options Server-specific configuration options */ constructor(options: ServerConstructorOptions); scope(...name: string[]): PailServerType; /** * Creates a child logger that inherits settings from the parent. * * Returns a new logger instance that inherits all configuration from the parent * (reporters, processors, types, log levels, throttle settings, etc.) while allowing * you to override only what you need. Child loggers are independent instances with * their own state (timers, counters, etc.). * @template N - The new custom logger type names * @template LC - The new log level types * @param options Configuration options to override or extend parent settings * @returns A new child logger instance * @example * ```typescript * const parent = createPail({ * logLevel: "info", * types: { http: { label: "HTTP", logLevel: "info" } }, * reporters: [new PrettyReporter()], * }); * * // Child inherits parent settings but overrides log level * const child = parent.child({ logLevel: "debug" }); * child.info("This will be logged"); // Uses debug level from child * child.http("GET /api 200"); // Inherits http type from parent * * // Child can add new types * const childWithNewType = parent.child({ * types: { db: { label: "DB", logLevel: "info" } }, * }); * childWithNewType.db("Query executed"); // New type available * ``` */ child(options?: Partial> & Partial, "interactive" | "stderr" | "stdout">>): PailServerType; /** * Gets the interactive manager instance if interactive mode is enabled. * * Returns the InteractiveManager instance that handles interactive terminal * features like progress bars and dynamic updates. Only available when * interactive mode is enabled in the constructor options. * @returns The interactive manager instance, or undefined if not in interactive mode * @example * ```typescript * const logger = createPail({ interactive: true }); * const manager = logger.getInteractiveManager(); * if (manager) { * manager.hook(); * // Use interactive features * manager.unhook(); * } * ``` */ getInteractiveManager(): InteractiveManager | undefined; /** * Wraps stdout and stderr streams to redirect them through the logger. * * Intercepts writes to process.stdout and process.stderr, redirecting them * through the logger instead of writing directly to the streams. This allows * all output to be processed by the logging pipeline. * @example * ```typescript * const logger = createPail(); * logger.wrapStd(); * * console.log("This goes through logger"); * process.stdout.write("This too"); * * logger.restoreStd(); // Restore original streams * ``` */ wrapStd(): void; /** * Restores the original stdout and stderr streams. * * Removes the stream wrapping that was applied by wrapStd(), * restoring the original stream write methods. * @example * ```typescript * const logger = createPail(); * logger.wrapStd(); * // Streams are wrapped * logger.restoreStd(); * // Streams are restored to original behavior * ``` */ restoreStd(): void; /** * Wraps all output sources (console and streams). * * Convenience method that calls both wrapConsole() and wrapStd() * to redirect all output through the logger. * @example * ```typescript * const logger = createPail(); * logger.wrapAll(); // Wraps console and streams * * // All output now goes through logger * console.log("Console output"); * process.stdout.write("Stream output"); * * logger.restoreAll(); // Restore everything * ``` */ wrapAll(): void; /** * Restores all wrapped output sources. * * Convenience method that calls both restoreConsole() and restoreStd() * to restore all original output behavior. * @example * ```typescript * const logger = createPail(); * logger.wrapAll(); * // All output is wrapped * logger.restoreAll(); * // All output sources are restored * ``` */ restoreAll(): void; /** * Creates a single progress bar. * @param options Configuration options for the progress bar * @returns A new ProgressBar instance * @example * ```typescript * const logger = createPail({ interactive: true }); * const bar = logger.createProgressBar({ * total: 100, * format: 'Downloading [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}' * }); * * bar.start(); * // ... do work and update progress * bar.update(50); * bar.stop(); * ``` */ createProgressBar(options: SingleBarOptions): ProgressBar; /** * Creates a multi-bar progress manager for displaying multiple progress bars. * @param options Configuration options for the multi-bar manager * @returns A new MultiProgressBar instance * @example * ```typescript * const logger = createPail({ interactive: true }); * const multiBar = logger.createMultiProgressBar(); * * const bar1 = multiBar.create(100); * const bar2 = multiBar.create(200); * * bar1.start(); * bar2.start(); * // ... update bars as needed * multiBar.stop(); * ``` */ createMultiProgressBar(options?: MultiBarOptions): MultiProgressBar; /** * Creates a single spinner. * @param options Configuration options for the spinner * @returns A new Spinner instance * @example * ```typescript * const logger = createPail({ interactive: true }); * const spinner = logger.createSpinner({ name: 'dots' }); * spinner.start('Loading...'); * // ... do work * spinner.succeed('Done'); * ``` */ createSpinner(options?: SpinnerOptions): Spinner; /** * Creates a multi-spinner manager for displaying multiple spinners. * @param options Configuration options for the multi-spinner manager * @returns A new MultiSpinner instance * @example * ```typescript * const logger = createPail({ interactive: true }); * const multiSpinner = logger.createMultiSpinner(); * * const spinner1 = multiSpinner.create('Loading 1'); * const spinner2 = multiSpinner.create('Loading 2'); * * spinner1.start(); * spinner2.start(); * // ... update spinners as needed * multiSpinner.stop(); * ``` */ createMultiSpinner(options?: SpinnerOptions): MultiSpinner; /** * Clears the terminal screen. * * Sends ANSI escape sequences to clear the terminal screen and move * the cursor to the top-left position. This overrides the browser * implementation to work with terminal streams. * @example * ```typescript * const logger = createPail(); * logger.info("Some output"); * logger.clear(); // Clears the terminal screen * ``` */ clear(): void; protected extendReporter(reporter: Reporter): Reporter; } export type PailServerType = Console & (new (options?: ServerConstructorOptions) => PailServerType) & PailServerImpl & Record & Record & { force: Record & Record; }; export type PailConstructor = new (options?: ServerConstructorOptions) => PailServerType; export declare const PailServer: PailServerType; export {};