genesys-cloud-streaming-client 17.2.4-develop.109 → 17.2.4-verbose-logging.3

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.
@@ -39,6 +39,17 @@ export declare class Client extends EventEmitter {
39
39
  _messenger: MessengerExtensionApi;
40
40
  _ping: Ping;
41
41
  constructor(options: IClientOptions);
42
+ _getAppInfoLoggerParams(): {
43
+ appId: string;
44
+ originAppName: string;
45
+ originAppVersion: string;
46
+ originAppId: string;
47
+ version: string;
48
+ };
49
+ _getStanzaConnectionInfo(): {
50
+ stanzaInstancaId: string | undefined;
51
+ channelId: string | undefined;
52
+ };
42
53
  private handleSendEventFromExtension;
43
54
  private checkIsBackgroundAssistant;
44
55
  private addInateEventHandlers;
@@ -73,7 +73,8 @@ class Client extends events_1.default {
73
73
  initializeServerLogging: !this.isGuest && !options.optOutOfWebrtcStatsTelemetry,
74
74
  /* streaming-client logging info */
75
75
  appVersion: Client.version,
76
- appName: 'streaming-client',
76
+ /* istanbul ignore next */
77
+ appName: (options.appName ? `${options.appName}:` : '') + 'streaming-client',
77
78
  logLevel: this.config.logLevel || 'info',
78
79
  logger: options.logger || console,
79
80
  formatters: options.logFormatters,
@@ -103,6 +104,24 @@ class Client extends events_1.default {
103
104
  this[extensionName] = extension.expose;
104
105
  this[`_${extensionName}`] = extension;
105
106
  });
107
+ this.logger.info('streaming-client instantiated', this._getAppInfoLoggerParams());
108
+ }
109
+ _getAppInfoLoggerParams() {
110
+ return {
111
+ appId: this.logger.clientId,
112
+ originAppName: this.config.appName || 'unknown',
113
+ originAppVersion: this.config.appVersion || 'unknown',
114
+ originAppId: this.config.appId || 'unknown',
115
+ version: this.version,
116
+ };
117
+ }
118
+ /* istanbul ignore next */
119
+ _getStanzaConnectionInfo() {
120
+ var _a, _b;
121
+ return {
122
+ stanzaInstancaId: (_a = this.activeStanzaInstance) === null || _a === void 0 ? void 0 : _a.id,
123
+ channelId: (_b = this.activeStanzaInstance) === null || _b === void 0 ? void 0 : _b.channelId
124
+ };
106
125
  }
107
126
  handleSendEventFromExtension(extension, data, message = false) {
108
127
  return extension.tokenBucket.removeTokens(1, () => {
@@ -178,7 +197,7 @@ class Client extends events_1.default {
178
197
  }
179
198
  async handleStanzaDisconnectedEvent(disconnectedInstance) {
180
199
  var _a, _b;
181
- this.logger.info('stanzaDisconnected event received', { stanzaInstanceId: disconnectedInstance.id, channelId: disconnectedInstance.channelId });
200
+ this.logger.info('stanzaDisconnected event received', { ...this._getAppInfoLoggerParams(), stanzaInstanceId: disconnectedInstance.id, channelId: disconnectedInstance.channelId });
182
201
  this.connected = false;
183
202
  this.connecting = false;
184
203
  (_a = disconnectedInstance.pinger) === null || _a === void 0 ? void 0 : _a.stop();
@@ -197,7 +216,7 @@ class Client extends events_1.default {
197
216
  }
198
217
  handleNoLongerSubscribed(stanzaInstance) {
199
218
  var _a, _b;
200
- this.logger.warn('noLongerSubscribed event received', { stanzaInstanceId: stanzaInstance.id, channelId: stanzaInstance.channelId });
219
+ this.logger.warn('noLongerSubscribed event received', { ...this._getAppInfoLoggerParams(), stanzaInstanceId: stanzaInstance.id, channelId: stanzaInstance.channelId });
201
220
  (_a = stanzaInstance.pinger) === null || _a === void 0 ? void 0 : _a.stop();
202
221
  (_b = stanzaInstance.serverMonitor) === null || _b === void 0 ? void 0 : _b.stop();
203
222
  this.hardReconnectRequired = true;
@@ -213,7 +232,7 @@ class Client extends events_1.default {
213
232
  this.hardReconnectRequired = true;
214
233
  }
215
234
  async disconnect() {
216
- this.logger.info('streamingClient.disconnect was called');
235
+ this.logger.info('streamingClient.disconnect was called', { ...this._getAppInfoLoggerParams() });
217
236
  if (!this.activeStanzaInstance) {
218
237
  return;
219
238
  }
@@ -277,7 +296,7 @@ class Client extends events_1.default {
277
296
  }
278
297
  this.setConnectionData(newConnectionData);
279
298
  clearTimeout(this.backoffReductionTimer);
280
- this.logger.debug('Setting timer for next backoff reduction since we haven\'t reached total reset', { msUntilReduction: msUntilNextReduction, delayMsAfterNextReduction: newConnectionData.delayMsAfterNextReduction });
299
+ this.logger.debug('Setting timer for next backoff reduction since we haven\'t reached total reset', { ...this._getAppInfoLoggerParams(), msUntilReduction: msUntilNextReduction, delayMsAfterNextReduction: newConnectionData.delayMsAfterNextReduction });
281
300
  this.backoffReductionTimer = setTimeout(() => this.decreaseBackoff(newConnectionData.delayMsAfterNextReduction), msUntilNextReduction);
282
301
  }
283
302
  getStartingDelay(connectionData, maxDelay) {
@@ -350,7 +369,7 @@ class Client extends events_1.default {
350
369
  message: axiosError.message
351
370
  };
352
371
  }
353
- this.logger.error('Failed to connect streaming client', { error });
372
+ this.logger.error('Failed to connect streaming client', { ...this._getAppInfoLoggerParams(), error });
354
373
  if (!err) {
355
374
  throw error;
356
375
  }
@@ -383,7 +402,7 @@ class Client extends events_1.default {
383
402
  };
384
403
  additionalErrorDetails.error = sanitizedError;
385
404
  if ([401, 403].includes(((_b = err.response) === null || _b === void 0 ? void 0 : _b.status) || 0)) {
386
- this.logger.error('Streaming client received an error that it can\'t recover from and will not attempt to reconnect', additionalErrorDetails);
405
+ this.logger.error('Streaming client received an error that it can\'t recover from and will not attempt to reconnect', { ...additionalErrorDetails, ...this._getAppInfoLoggerParams() });
387
406
  return false;
388
407
  }
389
408
  }
@@ -392,7 +411,7 @@ class Client extends events_1.default {
392
411
  if (err instanceof sasl_error_1.default) {
393
412
  this.logger.info('hardReconnectRequired set to true due to sasl error');
394
413
  this.hardReconnectRequired = true;
395
- Object.assign(additionalErrorDetails, { channelId: err.channelId, stanzaInstanceId: err.stanzaInstanceId });
414
+ Object.assign(additionalErrorDetails, { ...this._getAppInfoLoggerParams(), channelId: err.channelId, stanzaInstanceId: err.stanzaInstanceId });
396
415
  }
397
416
  // we don't need to log the stack for a timeout message
398
417
  if (err instanceof timeout_error_1.TimeoutError) {
@@ -417,7 +436,7 @@ class Client extends events_1.default {
417
436
  }
418
437
  }
419
438
  const connectionData = this.increaseBackoff();
420
- this.logger.error('Failed streaming client connection attempt, retrying', additionalErrorDetails, { skipServer: err instanceof offline_error_1.default });
439
+ this.logger.error('Failed streaming client connection attempt, retrying', { ...additionalErrorDetails, ...this._getAppInfoLoggerParams() }, { skipServer: err instanceof offline_error_1.default });
421
440
  this.logger.debug('debug: retry info', { expectedRetryInMs: connectionData.currentDelayMs, appName: this.config.appName, clientId: this.logger.clientId });
422
441
  return true;
423
442
  }
@@ -450,7 +469,7 @@ class Client extends events_1.default {
450
469
  }
451
470
  catch (err) {
452
471
  if (stanzaInstance) {
453
- this.logger.error('Error occurred in connection attempt, but after websocket connected. Cleaning up connection so backoff is respected', { stanzaInstanceId: stanzaInstance.id, channelId: stanzaInstance.channelId });
472
+ this.logger.error('Error occurred in connection attempt, but after websocket connected. Cleaning up connection so backoff is respected', { ...this._getAppInfoLoggerParams(), stanzaInstanceId: stanzaInstance.id, channelId: stanzaInstance.channelId });
454
473
  this.removeStanzaBoundEventHandlers();
455
474
  (_a = stanzaInstance.pinger) === null || _a === void 0 ? void 0 : _a.stop();
456
475
  (_b = stanzaInstance.serverMonitor) === null || _b === void 0 ? void 0 : _b.stop();
@@ -464,13 +483,14 @@ class Client extends events_1.default {
464
483
  async setupConnectionMonitoring(stanzaInstance) {
465
484
  const setupClientPinger = (message) => {
466
485
  const logMessage = `${message}, falling back to client-side pinging`;
467
- this.logger.warn(logMessage, { stanzaInstanceId: stanzaInstance.id, channelId: stanzaInstance.channelId });
486
+ this.logger.warn(logMessage, { ...this._getAppInfoLoggerParams(), stanzaInstanceId: stanzaInstance.id, channelId: stanzaInstance.channelId });
468
487
  stanzaInstance.pinger = new ping_1.Ping(this, stanzaInstance);
469
488
  };
470
489
  if (this.useServerSidePings) {
471
490
  try {
472
491
  // if this fails, then hawk doesn't support serverside pinging and we need to do client side pings
473
492
  await stanzaInstance.subscribeToNode(this._notifications.pubsubHost, 'enable.server.side.pings');
493
+ this.logger.info('using server-side pinging', { ...this._getAppInfoLoggerParams() });
474
494
  stanzaInstance.serverMonitor = new server_monitor_1.ServerMonitor(this, stanzaInstance);
475
495
  }
476
496
  catch (err) {
@@ -523,7 +543,7 @@ class Client extends events_1.default {
523
543
  this.config.jid = jid;
524
544
  this.config.channelId = channelId;
525
545
  this.autoReconnect = true;
526
- this.logger.info('attempting to connect streaming client on channel', { channelId });
546
+ this.logger.info('attempting to connect streaming client on channel', { ...this._getAppInfoLoggerParams(), channelId });
527
547
  this.connectionManager.setConfig(this.config);
528
548
  this.hardReconnectRequired = false;
529
549
  }
@@ -14,4 +14,5 @@ export declare class ConnectionManager {
14
14
  private getStanzaOptions;
15
15
  private getJwtOptions;
16
16
  private getStandardOptions;
17
+ private getAppInfoLoggerParams;
17
18
  }
@@ -46,7 +46,7 @@ class ConnectionManager {
46
46
  stanza.on('disconnected', boundSessionDisconnected);
47
47
  stanza.updateConfig(options);
48
48
  stanza.connect();
49
- }, 15 * 1000, 'connecting to streaming service', { channelId, stanzaInstanceId: stanza.id });
49
+ }, 15 * 1000, 'connecting to streaming service', { ...this.getAppInfoLoggerParams(), channelId, stanzaInstanceId: stanza.id });
50
50
  connectionAttemptPromise.catch(() => stanza.disconnect());
51
51
  return connectionAttemptPromise.finally(() => {
52
52
  stanza.off('raw:incoming', boundCheckForErrorStanza);
@@ -56,7 +56,7 @@ class ConnectionManager {
56
56
  });
57
57
  }
58
58
  handleSessionStarted(stanza, resolve) {
59
- this.logger.info('new stanza instance connected', { stanzaInstanceId: stanza.id, channelId: stanza.channelId });
59
+ this.logger.info('new stanza instance connected', { ...this.getAppInfoLoggerParams(), stanzaInstanceId: stanza.id, channelId: stanza.channelId });
60
60
  resolve(stanza);
61
61
  }
62
62
  handleSessionSasl(stanza, reject, sasl) {
@@ -65,7 +65,7 @@ class ConnectionManager {
65
65
  }
66
66
  }
67
67
  handleSessionDisconnected(stanza, reject) {
68
- this.logger.error('stanza disconnected', { stanzaInstanceId: stanza.id, channelId: stanza.channelId });
68
+ this.logger.error('stanza disconnected', { ...this.getAppInfoLoggerParams(), stanzaInstanceId: stanza.id, channelId: stanza.channelId });
69
69
  reject();
70
70
  }
71
71
  checkForErrorStanza(stanza, rawStanza) {
@@ -113,5 +113,13 @@ class ConnectionManager {
113
113
  }
114
114
  };
115
115
  }
116
+ getAppInfoLoggerParams() {
117
+ return {
118
+ appId: this.logger.clientId,
119
+ originAppName: this.config.appName || 'unknown',
120
+ originAppVersion: this.config.appVersion || 'unknown',
121
+ originAppId: this.config.appId || 'unknown',
122
+ };
123
+ }
116
124
  }
117
125
  exports.ConnectionManager = ConnectionManager;
@@ -62,11 +62,11 @@ class WebrtcExtension extends events_1.EventEmitter {
62
62
  this.addEventListeners();
63
63
  this.throttledSendStats = lodash_throttle_1.default(this.sendStats.bind(this), this.throttleSendStatsInterval, { leading: false, trailing: true });
64
64
  this.client.on('jingle:outgoing', (session) => {
65
- this.logger.info('Emitting jingle:outgoing media-session (session-init)', session);
65
+ this.logger.info('Emitting jingle:outgoing media-session (session-init)', { ...this.client._getAppInfoLoggerParams(), sessionId: session.id, sessionType: session.sessionType });
66
66
  return this.emit(events.OUTGOING_RTCSESSION, session);
67
67
  });
68
68
  this.client.on('jingle:incoming', (session) => {
69
- this.logger.info('Emitting jingle:incoming media-session (session-init)', session);
69
+ this.logger.info('Emitting jingle:incoming media-session (session-init)', { ...this.client._getAppInfoLoggerParams(), sessionId: session.id, sessionType: session.sessionType });
70
70
  return this.emit(events.INCOMING_RTCSESSION, session);
71
71
  });
72
72
  this.client.on('jingle:created', (session) => {
@@ -194,7 +194,7 @@ class WebrtcExtension extends events_1.EventEmitter {
194
194
  this.webrtcSessions = this.webrtcSessions.filter(s => s.id !== session.id);
195
195
  });
196
196
  this.webrtcSessions.push(session);
197
- this.logger.info('emitting sdp media-session (offer');
197
+ this.logger.info('emitting sdp media-session (offer)', { ...this.client._getAppInfoLoggerParams(), sessionId: session.id, sessionType: session.sessionType });
198
198
  return this.emit(events.INCOMING_RTCSESSION, session);
199
199
  }
200
200
  async handleGenesysRenegotiate(existingSession, newSdp) {
@@ -448,7 +448,7 @@ class WebrtcExtension extends events_1.EventEmitter {
448
448
  let sessionInfo = this.pendingSessions[sessionId];
449
449
  const isDuplicatePropose = !!sessionInfo;
450
450
  const sessionType = this.getSessionTypeByJid(msg.from);
451
- const loggingParams = { sessionId: sessionId, conversationId: msg.propose.conversationId, sessionType, isDuplicatePropose };
451
+ const loggingParams = { ...this.client._getAppInfoLoggerParams(), ...this.client._getStanzaConnectionInfo(), sessionId: sessionId, conversationId: msg.propose.conversationId, sessionType, isDuplicatePropose };
452
452
  this.logger.info('propose received', loggingParams);
453
453
  if (!isDuplicatePropose) {
454
454
  const { appId } = this.client.config;
@@ -489,7 +489,7 @@ class WebrtcExtension extends events_1.EventEmitter {
489
489
  this.emit(events.REQUEST_INCOMING_RTCSESSION, Object.assign(sessionInfo));
490
490
  }
491
491
  handleRetract(sessionId) {
492
- this.logger.info('retract received', this.getLogDetailsForPendingSessionId(sessionId));
492
+ this.logger.info('retract received', { ...this.getLogDetailsForPendingSessionId(sessionId), ...this.client._getAppInfoLoggerParams(), ...this.client._getStanzaConnectionInfo() });
493
493
  delete this.pendingSessions[sessionId];
494
494
  return this.emit(events.CANCEL_INCOMING_RTCSESSION, sessionId);
495
495
  }
@@ -575,13 +575,13 @@ class WebrtcExtension extends events_1.EventEmitter {
575
575
  }
576
576
  };
577
577
  session.accepted = true;
578
- const details = this.getLogDetailsForPendingSessionId(sessionId);
578
+ const details = { ...this.getLogDetailsForPendingSessionId(sessionId), ...this.client._getAppInfoLoggerParams(), ...this.client._getStanzaConnectionInfo() };
579
579
  this.logger.info('sending jingle proceed', details);
580
580
  await this.stanzaInstance.send('message', proceed); // send as Message
581
581
  this.logger.info('sent jingle proceed', details);
582
582
  }
583
583
  async rejectRtcSession(sessionId, ignore = false) {
584
- const logDetails = this.getLogDetailsForPendingSessionId(sessionId);
584
+ const logDetails = { ...this.getLogDetailsForPendingSessionId(sessionId), ...this.client._getAppInfoLoggerParams(), ...this.client._getStanzaConnectionInfo() };
585
585
  const session = this.pendingSessions[sessionId];
586
586
  if (!session) {
587
587
  this.emit(events.RTCSESSION_ERROR, 'Cannot reject session because it is not pending or does not exist');
@@ -613,7 +613,7 @@ class WebrtcExtension extends events_1.EventEmitter {
613
613
  }
614
614
  async rtcSessionAccepted(sessionId) {
615
615
  const pendingSession = this.pendingSessions[sessionId];
616
- const logDetails = this.getLogDetailsForPendingSessionId(sessionId);
616
+ const logDetails = { ...this.getLogDetailsForPendingSessionId(sessionId), ...this.client._getAppInfoLoggerParams(), ...this.client._getStanzaConnectionInfo() };
617
617
  const accept = {
618
618
  to: JID_1.toBare(this.jid),
619
619
  accept: {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "developercenter-cdn/streaming-client",
3
- "version": "17.2.4",
3
+ "version": "verbose-logging",
4
4
  "ecosystem": "pc",
5
5
  "team": "Client Streaming and Signaling",
6
6
  "indexFiles": [
@@ -17,6 +17,6 @@
17
17
  "file": "v17/streaming-client.browser.js"
18
18
  }
19
19
  ],
20
- "build": "109",
21
- "buildDate": "2024-08-07T21:01:41.401465775Z"
20
+ "build": "3",
21
+ "buildDate": "2024-08-15T12:46:00.063206700Z"
22
22
  }
@@ -39,6 +39,17 @@ export declare class Client extends EventEmitter {
39
39
  _messenger: MessengerExtensionApi;
40
40
  _ping: Ping;
41
41
  constructor(options: IClientOptions);
42
+ _getAppInfoLoggerParams(): {
43
+ appId: string;
44
+ originAppName: string;
45
+ originAppVersion: string;
46
+ originAppId: string;
47
+ version: string;
48
+ };
49
+ _getStanzaConnectionInfo(): {
50
+ stanzaInstancaId: string | undefined;
51
+ channelId: string | undefined;
52
+ };
42
53
  private handleSendEventFromExtension;
43
54
  private checkIsBackgroundAssistant;
44
55
  private addInateEventHandlers;
package/dist/es/client.js CHANGED
@@ -71,7 +71,8 @@ export class Client extends EventEmitter {
71
71
  initializeServerLogging: !this.isGuest && !options.optOutOfWebrtcStatsTelemetry,
72
72
  /* streaming-client logging info */
73
73
  appVersion: Client.version,
74
- appName: 'streaming-client',
74
+ /* istanbul ignore next */
75
+ appName: (options.appName ? `${options.appName}:` : '') + 'streaming-client',
75
76
  logLevel: this.config.logLevel || 'info',
76
77
  logger: options.logger || console,
77
78
  formatters: options.logFormatters,
@@ -101,6 +102,24 @@ export class Client extends EventEmitter {
101
102
  this[extensionName] = extension.expose;
102
103
  this[`_${extensionName}`] = extension;
103
104
  });
105
+ this.logger.info('streaming-client instantiated', this._getAppInfoLoggerParams());
106
+ }
107
+ _getAppInfoLoggerParams() {
108
+ return {
109
+ appId: this.logger.clientId,
110
+ originAppName: this.config.appName || 'unknown',
111
+ originAppVersion: this.config.appVersion || 'unknown',
112
+ originAppId: this.config.appId || 'unknown',
113
+ version: this.version,
114
+ };
115
+ }
116
+ /* istanbul ignore next */
117
+ _getStanzaConnectionInfo() {
118
+ var _a, _b;
119
+ return {
120
+ stanzaInstancaId: (_a = this.activeStanzaInstance) === null || _a === void 0 ? void 0 : _a.id,
121
+ channelId: (_b = this.activeStanzaInstance) === null || _b === void 0 ? void 0 : _b.channelId
122
+ };
104
123
  }
105
124
  handleSendEventFromExtension(extension, data, message = false) {
106
125
  return extension.tokenBucket.removeTokens(1, () => {
@@ -177,7 +196,7 @@ export class Client extends EventEmitter {
177
196
  handleStanzaDisconnectedEvent(disconnectedInstance) {
178
197
  var _a, _b;
179
198
  return __awaiter(this, void 0, void 0, function* () {
180
- this.logger.info('stanzaDisconnected event received', { stanzaInstanceId: disconnectedInstance.id, channelId: disconnectedInstance.channelId });
199
+ this.logger.info('stanzaDisconnected event received', Object.assign(Object.assign({}, this._getAppInfoLoggerParams()), { stanzaInstanceId: disconnectedInstance.id, channelId: disconnectedInstance.channelId }));
181
200
  this.connected = false;
182
201
  this.connecting = false;
183
202
  (_a = disconnectedInstance.pinger) === null || _a === void 0 ? void 0 : _a.stop();
@@ -197,7 +216,7 @@ export class Client extends EventEmitter {
197
216
  }
198
217
  handleNoLongerSubscribed(stanzaInstance) {
199
218
  var _a, _b;
200
- this.logger.warn('noLongerSubscribed event received', { stanzaInstanceId: stanzaInstance.id, channelId: stanzaInstance.channelId });
219
+ this.logger.warn('noLongerSubscribed event received', Object.assign(Object.assign({}, this._getAppInfoLoggerParams()), { stanzaInstanceId: stanzaInstance.id, channelId: stanzaInstance.channelId }));
201
220
  (_a = stanzaInstance.pinger) === null || _a === void 0 ? void 0 : _a.stop();
202
221
  (_b = stanzaInstance.serverMonitor) === null || _b === void 0 ? void 0 : _b.stop();
203
222
  this.hardReconnectRequired = true;
@@ -214,7 +233,7 @@ export class Client extends EventEmitter {
214
233
  }
215
234
  disconnect() {
216
235
  return __awaiter(this, void 0, void 0, function* () {
217
- this.logger.info('streamingClient.disconnect was called');
236
+ this.logger.info('streamingClient.disconnect was called', Object.assign({}, this._getAppInfoLoggerParams()));
218
237
  if (!this.activeStanzaInstance) {
219
238
  return;
220
239
  }
@@ -279,7 +298,7 @@ export class Client extends EventEmitter {
279
298
  }
280
299
  this.setConnectionData(newConnectionData);
281
300
  clearTimeout(this.backoffReductionTimer);
282
- this.logger.debug('Setting timer for next backoff reduction since we haven\'t reached total reset', { msUntilReduction: msUntilNextReduction, delayMsAfterNextReduction: newConnectionData.delayMsAfterNextReduction });
301
+ this.logger.debug('Setting timer for next backoff reduction since we haven\'t reached total reset', Object.assign(Object.assign({}, this._getAppInfoLoggerParams()), { msUntilReduction: msUntilNextReduction, delayMsAfterNextReduction: newConnectionData.delayMsAfterNextReduction }));
283
302
  this.backoffReductionTimer = setTimeout(() => this.decreaseBackoff(newConnectionData.delayMsAfterNextReduction), msUntilNextReduction);
284
303
  }
285
304
  getStartingDelay(connectionData, maxDelay) {
@@ -353,7 +372,7 @@ export class Client extends EventEmitter {
353
372
  message: axiosError.message
354
373
  };
355
374
  }
356
- this.logger.error('Failed to connect streaming client', { error });
375
+ this.logger.error('Failed to connect streaming client', Object.assign(Object.assign({}, this._getAppInfoLoggerParams()), { error }));
357
376
  if (!err) {
358
377
  throw error;
359
378
  }
@@ -388,7 +407,7 @@ export class Client extends EventEmitter {
388
407
  };
389
408
  additionalErrorDetails.error = sanitizedError;
390
409
  if ([401, 403].includes(((_b = err.response) === null || _b === void 0 ? void 0 : _b.status) || 0)) {
391
- this.logger.error('Streaming client received an error that it can\'t recover from and will not attempt to reconnect', additionalErrorDetails);
410
+ this.logger.error('Streaming client received an error that it can\'t recover from and will not attempt to reconnect', Object.assign(Object.assign({}, additionalErrorDetails), this._getAppInfoLoggerParams()));
392
411
  return false;
393
412
  }
394
413
  }
@@ -397,7 +416,7 @@ export class Client extends EventEmitter {
397
416
  if (err instanceof SaslError) {
398
417
  this.logger.info('hardReconnectRequired set to true due to sasl error');
399
418
  this.hardReconnectRequired = true;
400
- Object.assign(additionalErrorDetails, { channelId: err.channelId, stanzaInstanceId: err.stanzaInstanceId });
419
+ Object.assign(additionalErrorDetails, Object.assign(Object.assign({}, this._getAppInfoLoggerParams()), { channelId: err.channelId, stanzaInstanceId: err.stanzaInstanceId }));
401
420
  }
402
421
  // we don't need to log the stack for a timeout message
403
422
  if (err instanceof TimeoutError) {
@@ -422,7 +441,7 @@ export class Client extends EventEmitter {
422
441
  }
423
442
  }
424
443
  const connectionData = this.increaseBackoff();
425
- this.logger.error('Failed streaming client connection attempt, retrying', additionalErrorDetails, { skipServer: err instanceof OfflineError });
444
+ this.logger.error('Failed streaming client connection attempt, retrying', Object.assign(Object.assign({}, additionalErrorDetails), this._getAppInfoLoggerParams()), { skipServer: err instanceof OfflineError });
426
445
  this.logger.debug('debug: retry info', { expectedRetryInMs: connectionData.currentDelayMs, appName: this.config.appName, clientId: this.logger.clientId });
427
446
  return true;
428
447
  });
@@ -457,7 +476,7 @@ export class Client extends EventEmitter {
457
476
  }
458
477
  catch (err) {
459
478
  if (stanzaInstance) {
460
- this.logger.error('Error occurred in connection attempt, but after websocket connected. Cleaning up connection so backoff is respected', { stanzaInstanceId: stanzaInstance.id, channelId: stanzaInstance.channelId });
479
+ this.logger.error('Error occurred in connection attempt, but after websocket connected. Cleaning up connection so backoff is respected', Object.assign(Object.assign({}, this._getAppInfoLoggerParams()), { stanzaInstanceId: stanzaInstance.id, channelId: stanzaInstance.channelId }));
461
480
  this.removeStanzaBoundEventHandlers();
462
481
  (_a = stanzaInstance.pinger) === null || _a === void 0 ? void 0 : _a.stop();
463
482
  (_b = stanzaInstance.serverMonitor) === null || _b === void 0 ? void 0 : _b.stop();
@@ -473,13 +492,14 @@ export class Client extends EventEmitter {
473
492
  return __awaiter(this, void 0, void 0, function* () {
474
493
  const setupClientPinger = (message) => {
475
494
  const logMessage = `${message}, falling back to client-side pinging`;
476
- this.logger.warn(logMessage, { stanzaInstanceId: stanzaInstance.id, channelId: stanzaInstance.channelId });
495
+ this.logger.warn(logMessage, Object.assign(Object.assign({}, this._getAppInfoLoggerParams()), { stanzaInstanceId: stanzaInstance.id, channelId: stanzaInstance.channelId }));
477
496
  stanzaInstance.pinger = new Ping(this, stanzaInstance);
478
497
  };
479
498
  if (this.useServerSidePings) {
480
499
  try {
481
500
  // if this fails, then hawk doesn't support serverside pinging and we need to do client side pings
482
501
  yield stanzaInstance.subscribeToNode(this._notifications.pubsubHost, 'enable.server.side.pings');
502
+ this.logger.info('using server-side pinging', Object.assign({}, this._getAppInfoLoggerParams()));
483
503
  stanzaInstance.serverMonitor = new ServerMonitor(this, stanzaInstance);
484
504
  }
485
505
  catch (err) {
@@ -534,7 +554,7 @@ export class Client extends EventEmitter {
534
554
  this.config.jid = jid;
535
555
  this.config.channelId = channelId;
536
556
  this.autoReconnect = true;
537
- this.logger.info('attempting to connect streaming client on channel', { channelId });
557
+ this.logger.info('attempting to connect streaming client on channel', Object.assign(Object.assign({}, this._getAppInfoLoggerParams()), { channelId }));
538
558
  this.connectionManager.setConfig(this.config);
539
559
  this.hardReconnectRequired = false;
540
560
  }
@@ -14,4 +14,5 @@ export declare class ConnectionManager {
14
14
  private getStanzaOptions;
15
15
  private getJwtOptions;
16
16
  private getStandardOptions;
17
+ private getAppInfoLoggerParams;
17
18
  }
@@ -44,7 +44,7 @@ export class ConnectionManager {
44
44
  stanza.on('disconnected', boundSessionDisconnected);
45
45
  stanza.updateConfig(options);
46
46
  stanza.connect();
47
- }, 15 * 1000, 'connecting to streaming service', { channelId, stanzaInstanceId: stanza.id });
47
+ }, 15 * 1000, 'connecting to streaming service', Object.assign(Object.assign({}, this.getAppInfoLoggerParams()), { channelId, stanzaInstanceId: stanza.id }));
48
48
  connectionAttemptPromise.catch(() => stanza.disconnect());
49
49
  return connectionAttemptPromise.finally(() => {
50
50
  stanza.off('raw:incoming', boundCheckForErrorStanza);
@@ -55,7 +55,7 @@ export class ConnectionManager {
55
55
  });
56
56
  }
57
57
  handleSessionStarted(stanza, resolve) {
58
- this.logger.info('new stanza instance connected', { stanzaInstanceId: stanza.id, channelId: stanza.channelId });
58
+ this.logger.info('new stanza instance connected', Object.assign(Object.assign({}, this.getAppInfoLoggerParams()), { stanzaInstanceId: stanza.id, channelId: stanza.channelId }));
59
59
  resolve(stanza);
60
60
  }
61
61
  handleSessionSasl(stanza, reject, sasl) {
@@ -64,7 +64,7 @@ export class ConnectionManager {
64
64
  }
65
65
  }
66
66
  handleSessionDisconnected(stanza, reject) {
67
- this.logger.error('stanza disconnected', { stanzaInstanceId: stanza.id, channelId: stanza.channelId });
67
+ this.logger.error('stanza disconnected', Object.assign(Object.assign({}, this.getAppInfoLoggerParams()), { stanzaInstanceId: stanza.id, channelId: stanza.channelId }));
68
68
  reject();
69
69
  }
70
70
  checkForErrorStanza(stanza, rawStanza) {
@@ -112,4 +112,12 @@ export class ConnectionManager {
112
112
  }
113
113
  };
114
114
  }
115
+ getAppInfoLoggerParams() {
116
+ return {
117
+ appId: this.logger.clientId,
118
+ originAppName: this.config.appName || 'unknown',
119
+ originAppVersion: this.config.appVersion || 'unknown',
120
+ originAppId: this.config.appId || 'unknown',
121
+ };
122
+ }
115
123
  }