import { TreeNode } from "../data/tree.js"; import type { BareLogger } from "./log.js"; /** * An entry of a {@linkcode Report}. */ export interface ReportEntry { /** * The message in the entry. */ message: string; /** * An optional key-value hash, that might have been * provided with the entry. */ context: Record | undefined; } /** * Ensures an origin stays within reasonable display size. * @param origin - The original log origin. * @returns A shortened origin for display. */ export declare const makeLogOrigin: (origin: string) => string; /** * A hierarchical background report/log. */ export declare class Report extends TreeNode { #private; /** * The ID of this report. */ readonly origin: string; /** * Retrieve the message store. * @returns The message store. */ get store(): Map>; /** * Constructs a new report. * @param origin - The ID of this report. * @param parent - The paren report for this report. * @throws {@linkcode InvalidOperationError} When the origin was already * used by another report in this hierarchy. */ constructor(origin: string, parent?: Report); /** * Put an entry into the report. * @param message - The message to add. * @param context - An arbitrary key-value object to store with the message. */ log(message: string, context?: Record): void; /** * Prints the contents of the report. * @param logger - A logger to use to print the report. * @param depth - How deep to indent this part of the report. */ aggregate(logger: BareLogger, depth?: number): void; }