-
Notifications
You must be signed in to change notification settings - Fork 0
class trace
awekrx edited this page May 29, 2026
·
1 revision
import { classTrace } from '@dev-suite/decorators/class-trace'
class
Trace class construction lifecycle for debugging and operations visibility.
- Constructor-level console/log boilerplate
- Repeated try/catch logging wrappers around
new
class KafkaConsumer {
constructor(private readonly topic: string) {
console.info('KafkaConsumer:init:start', { topic });
try {
this.connect();
console.info('KafkaConsumer:init:ok', { topic });
} catch (error) {
console.error('KafkaConsumer:init:fail', { topic, error });
throw error;
}
}
private connect() {}
}import { classTrace } from '@dev-suite/decorators/class-trace';
@classTrace()
class KafkaConsumer {
constructor(private readonly topic: string) {
this.connect();
}
private connect() {}
}- Standardizes constructor trace shape
- Keeps constructor focused on initialization logic
class FileIngestWorker {
constructor(private readonly source: string) {
console.info('worker:start', { source });
this.bootstrap();
console.info('worker:ready', { source });
}
private bootstrap() {}
}import { classTrace } from '@dev-suite/decorators/class-trace';
@classTrace({ shouldIncludeArgs: true })
class FileIngestWorker {
constructor(private readonly source: string) {
this.bootstrap();
}
private bootstrap() {}
}- Consistent observability across worker classes
- Optional args tracing without custom logger glue