diff --git a/packages/logger/src/logger.ts b/packages/logger/src/logger.ts index 22c7335f..f5a5549f 100644 --- a/packages/logger/src/logger.ts +++ b/packages/logger/src/logger.ts @@ -115,6 +115,8 @@ export const createLogger = (domain: string, debugMode = defaultDebugMode): Alwa logMethodFull: console.debug.bind(console, _keySection + '.%s(%o) => %o', styleScope, domain, _style.reset), + logStep: console.debug.bind(console, _keySection + '.%s() -> %s', styleScope, domain, _style.reset), + logOther: console.debug.bind(console, _keySection, styleScope, domain, _style.reset), incident: platformInfo.isCli diff --git a/packages/logger/src/type.ts b/packages/logger/src/type.ts index 167c2227..27b18c17 100644 --- a/packages/logger/src/type.ts +++ b/packages/logger/src/type.ts @@ -54,7 +54,24 @@ export interface AlwatrLogger { * } * ``` */ - logMethodArgs?(method: string, args: unknown): void; + + /** + * `console.debug` steps in a method. + * + * Example: + * + * ```ts + * function myMethod () { + * logger.logMethod?.('myMethod'); + * ... + * logger.logStep?.('myMethod', 'step1'); + * ... + * logger.logStep?.('myMethod', 'step2'); + * ... + * } + * ``` + */ + logStep?(methodName: string, stepName: string, props?: unknown): void; /** * `console.debug` function or method calls with arguments.