/** * @file Free-function bodies for the `Logger` indentation-domain methods * (`indent`, `dedent`, `resetIndent`, `group`, `groupCollapsed`, `groupEnd`). * Indentation is tracked at the prefix layer as a per-stream string of * spaces rather than via `node:console`'s frozen `Symbol(kGroupIndent)`, so * these helpers read and write that prefix through a small accessor context * handed in by the calling `Logger`. Pulling these out of `./node` keeps the * `Logger` class body under the file-size cap; the class retains one-line * delegators that build the context from its private state. */ import type { LoggerTrackable } from './console-methods.js'; /** * The slice of `Logger` the indentation helpers need: the bound-stream marker * (`undefined` on the root logger, `'stderr'` / `'stdout'` on a stream-bound * instance) plus per-stream indent prefix read / write accessors. Modeled * structurally to avoid a circular import with `./node`; the class supplies * closures over its private `#getIndent` / `#setIndent`. */ export interface IndentContext { boundStream: 'stderr' | 'stdout' | undefined; getIndent(stream: 'stderr' | 'stdout'): string; setIndent(stream: 'stderr' | 'stdout', value: string): void; } /** * Decrease the indentation prefix by `spaces`. * * On the root logger (`boundStream` undefined) both streams shrink; on a * stream-bound logger only the bound stream shrinks. Returns the logger for * chaining. * * @param logger - The calling logger instance. * @param ctx - The logger's indentation accessor context. * @param spaces - Number of spaces to remove (default 2). */ export declare function dedentMethod(logger: T, ctx: IndentContext, spaces: number): T; /** * End the current log group and decrease indentation by the group-indent width. * * Call once per `groupMethod` / `groupCollapsed`. Returns the logger for * chaining. * * @param logger - The calling logger instance. */ export declare function groupEndMethod(logger: T): T; /** * Start a new indented log group. * * A provided label is logged via the logger's own `log` before indentation * increases by the group-indent width (default 2). Groups nest; close with * `groupEndMethod`. Returns the logger for chaining. * * @param logger - The calling logger instance. * @param label - Optional label to display before the group. */ export declare function groupMethod(logger: T, label: unknown[]): T; /** * Increase the indentation prefix by `spaces`, capped at `maxIndentation`. * * On the root logger both streams grow; on a stream-bound logger only the bound * stream grows. Returns the logger for chaining. * * @param logger - The calling logger instance. * @param ctx - The logger's indentation accessor context. * @param spaces - Number of spaces to add (default 2). */ export declare function indentMethod(logger: T, ctx: IndentContext, spaces: number): T; /** * Reset all indentation to zero. * * On the root logger both streams reset; on a stream-bound logger only the * bound stream resets. Returns the logger for chaining. * * @param logger - The calling logger instance. * @param ctx - The logger's indentation accessor context. */ export declare function resetIndentMethod(logger: T, ctx: IndentContext): T;