type ProcessMethods = { log: (message: string) => ProcessMethods; end: () => void; }; /** * ### ProcessLog * A logging function used to log steps of a process. * - The idea is to leave the logs in your code and enable or disable them as needed by enabling or disabling the `log` property in your Log.start() call. * - This is useful to quickly log the flow of a process when developing or debugging, and other developers can easily enable or disable the logs to see the process running. * --- * Usage * ```typescript * // Start * Log.start({ name: "processName", log: true }); // Start the process by naming it. * ``` * * ```typescript * // Start * Log.log.processName("Message to log"); // Log a message * ``` * * ```typescript * // End * Log.end.processName(); // End the process * ``` * --- * Examples * ```typescript * Log.start({ name: "datasource", log: true }); // Start the process * Log.log.datasource("Creating data source"); // Log a message * Log.log.datasource("SUCCESS - Fetched data source"); // Log another message * Log.log.datasource("Parsed data source template"); * Log.end.datasource(); // End the process * ``` * --- * Example log output * ``` json * ----- START DATASOURCE - Process logger. ----- * datasource: Creating data source * datasource: SUCCESS - Fetched data source /page.tsx:12 * datasource: Parsed data source template /page.tsx:12 * ----- END DATASOURCE - Process logger. Completed in 1.46 seconds. ----- * ``` * --- * Options for Log.start() * - `name`: The name of the process to start. * - `description`: A description of the process. * - `log`: Set to false to disable logging for the process. * - `color`: A custom color for the process. * */ export declare class Log { private processName; private static processes; private logs; private active; private startTime; private color; private static colors; static log: Record ProcessMethods>; static end: Record void>; private constructor(); /** * Start a new process log. * - `name` Add a name to the process. This will be used to reference the logs in the process. * - `log` You can enable or disable logging for the process by setting the `log` property to true or false. * - `description` You can add a description to the process. * - `color` You can set a specific color for the process. * --- * Example * ```typescript * Log.start({ name: "myProcess"}); * ``` * --- * Additional options: `log`, `description`, `color` * Example * ```typescript * Log.start({ name: "myProcess", log: true, description: "Fetches data source templates.", color: "#2a9d8f" }); * ``` */ static start({ name, log, description, color, }: { name: string; log?: boolean; description?: string; color?: string; }): void; private log; /** * End the process and log the duration. * @example * Log.end.myProcess(); */ private end; } export {}; //# sourceMappingURL=index.d.ts.map