-
Notifications
You must be signed in to change notification settings - Fork 0
debug fn args
awekrx edited this page May 29, 2026
·
1 revision
import { debugFnArgs } from '@dev-suite/decorators/debug-fn-args'
method
Log method arguments in a consistent debug format.
- Temporary
console.log(args)scattered in methods - Custom per-method debug wrappers
class PaymentService {
charge(amount: number, cardToken: string) {
console.log('charge args', { amount, cardToken: cardToken.slice(0, 4) + '***' });
return this.gateway.charge(amount, cardToken);
}
}import { debugFnArgs } from '@dev-suite/decorators/debug-fn-args';
class PaymentService {
@debugFnArgs({ label: 'payment.charge' })
charge(amount: number, cardToken: string) {
return this.gateway.charge(amount, cardToken);
}
}- Keeps debug policy configurable without polluting method body.
- Labeling format is standardized.
class ReportService {
run(filters: ReportFilters) {
console.log('run filters', filters);
return this.engine.run(filters);
}
}import { debugFnArgs } from '@dev-suite/decorators/debug-fn-args';
class ReportService {
@debugFnArgs({ formatArgs: ([filters]) => ({ range: filters.range, type: filters.type }) })
run(filters: ReportFilters) {
return this.engine.run(filters);
}
}- Can redact/shape logs via formatter in one place.
- Safer and more consistent than inline logging.