Skip to content

Commit ab3a4b4

Browse files
feat: add debug log
1 parent 1af15b1 commit ab3a4b4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/infrastructure/adapters/ApnAdapter.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import { config } from '../../../config.js';
2+
import { logger } from '../Logger.js';
23
import { httpAdapter } from './HttpAdapter.js';
34
import { jsonWebTokenAdapter } from './JsonWebTokenAdapter.js';
45
import { NotificationAdapter } from './NotificationAdapter.js';
56

67
export class ApnAdapter extends NotificationAdapter {
7-
constructor({ url, topic, jsonWebTokenAdapter, httpAdapter }) {
8+
constructor({ url, topic, jsonWebTokenAdapter, httpAdapter, logger }) {
89
super();
910
this.url = url;
1011
this.topic = topic;
1112
this.jsonWebTokenAdapter = jsonWebTokenAdapter;
1213
this.httpAdapter = httpAdapter;
14+
this.logger = logger;
1315
}
1416

1517
async notify(pushToken) {
@@ -19,7 +21,7 @@ export class ApnAdapter extends NotificationAdapter {
1921
'apns-topic': this.topic,
2022
};
2123
const url = `${this.url}/3/device/${pushToken}`;
22-
24+
this.logger.debug(`Notify device ${pushToken}`);
2325
return this.httpAdapter.post(url, headers, {});
2426
}
2527

@@ -49,4 +51,5 @@ export const apnAdapter = new ApnAdapter({
4951
...config.notifications.apple,
5052
jsonWebTokenAdapter,
5153
httpAdapter,
54+
logger,
5255
});

0 commit comments

Comments
 (0)