Skip to content

Commit 834dd0b

Browse files
committed
🔊 improve and tidy up logs
1 parent ebddea2 commit 834dd0b

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

src/cache/storage/redis-storage-adapter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export class RedisStorageAdapter implements StorageAdapter {
4747
if (!value) {
4848
return null;
4949
}
50+
5051
const decompressed = await inflate(Buffer.from(value, 'base64'));
5152
const result = JSON.parse(decompressed.toString());
5253
return result;

src/cache/token-cache-storage.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ export class TokenCacheStorage implements TokenCache {
1717
public async get(key: string): Promise<TokenCacheItem | null> {
1818
const keyWithPrefix = this.buildKey(key);
1919
try {
20-
infoLogger(
21-
this.logPrefix,
22-
'Trying to get token from cache',
23-
keyWithPrefix,
24-
);
2520
return await this.storage.get<TokenCacheItem>(keyWithPrefix);
2621
} catch (e) {
2722
errorLogger(

src/models/controller.model.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@ export class Controller {
274274
res: Response,
275275
next: NextFunction,
276276
): Promise<void> {
277-
console.log('traceIdFromHeader', req.headers.traceparent);
278-
279277
const { providerConfig } = req;
280278
try {
281279
if (!providerConfig) {
@@ -293,7 +291,7 @@ export class Controller {
293291

294292
infoLogger(
295293
'streamContacts',
296-
`Starting contact streaming ${timestamp} - orderingKey ${orderingKey}`,
294+
`[${orderingKey}] Starting contact streaming`,
297295
providerConfig.apiKey,
298296
);
299297

@@ -312,14 +310,13 @@ export class Controller {
312310
),
313311
state: PubSubContactsState.IN_PROGRESS,
314312
integrationName: this.integrationName,
315-
// traceparent: tracer.getTraceParent(),
316313
},
317314
orderingKey,
318315
);
319316
} catch (error) {
320317
errorLogger(
321318
'streamContacts',
322-
`Could not publish contacts`,
319+
`[${orderingKey}] Could not publish contacts`,
323320
providerConfig.apiKey,
324321
error,
325322
);
@@ -352,15 +349,14 @@ export class Controller {
352349
contacts: [],
353350
state: PubSubContactsState.COMPLETE,
354351
integrationName: this.integrationName,
355-
// traceparent: tracer.getTraceParent(),
356352
},
357353
orderingKey,
358354
);
359355
})
360356
.catch(async (error) => {
361357
errorLogger(
362358
'streamContacts',
363-
'Could not stream contacts',
359+
`[${orderingKey}] Could not stream contacts`,
364360
providerConfig.apiKey,
365361
error,
366362
);
@@ -371,15 +367,14 @@ export class Controller {
371367
contacts: [],
372368
state: PubSubContactsState.FAILED,
373369
integrationName: this.integrationName,
374-
// traceparent: tracer.getTraceParent(),
375370
},
376371
orderingKey,
377372
);
378373
})
379374
.catch((error) => {
380375
errorLogger(
381376
'streamContacts',
382-
'Could not publish failed message',
377+
`[${orderingKey}] Could not publish failed message`,
383378
providerConfig.apiKey,
384379
error,
385380
);
@@ -395,14 +390,18 @@ export class Controller {
395390
} catch (error) {
396391
errorLogger(
397392
'streamContacts',
398-
'Could not get and refresh token',
393+
`[${orderingKey}] Could not get and refresh token`,
399394
providerConfig.apiKey,
400395
error,
401396
);
402397
}
403398
}
404399

405-
infoLogger('streamContacts', 'END', providerConfig.apiKey);
400+
infoLogger(
401+
`[${orderingKey}] streamContacts`,
402+
'END',
403+
providerConfig.apiKey,
404+
);
406405

407406
res.status(200).send({ timestamp });
408407

@@ -419,7 +418,7 @@ export class Controller {
419418

420419
errorLogger(
421420
'streamContacts',
422-
'Could not stream contacts',
421+
`Could not stream contacts`,
423422
providerConfig?.apiKey,
424423
error,
425424
);

0 commit comments

Comments
 (0)