@solidxai/core 0.1.6-beta.3 → 0.1.6-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ import { buildNamespacedQueueName } from './common';
8
8
 
9
9
 
10
10
  export abstract class RabbitMqSubscriber<T> implements OnModuleInit, QueueSubscriber<T> { // TODO This can be made a generic type for better type visibility
11
- private readonly logger = new Logger(RabbitMqSubscriber.name);
11
+ private _loggerInstance?: Logger;
12
12
  private readonly url: string;
13
13
  private readonly serviceRole: string;
14
14
  private connection: amqp.Connection | null = null;
@@ -30,6 +30,17 @@ export abstract class RabbitMqSubscriber<T> implements OnModuleInit, QueueSubscr
30
30
  // this.logger.debug(`RabbitMqSubscriber instance created with options: ${JSON.stringify(this.options())} and url: ${this.url}`);
31
31
  }
32
32
 
33
+ protected get loggerContext(): string {
34
+ return this.constructor.name;
35
+ }
36
+
37
+ protected get logger(): Logger {
38
+ if (!this._loggerInstance) {
39
+ this._loggerInstance = new Logger(this.loggerContext);
40
+ }
41
+ return this._loggerInstance;
42
+ }
43
+
33
44
  abstract subscribe(message: QueueMessage<T>);
34
45
 
35
46
  abstract options(): QueuesModuleOptions;