diff --git a/apps/api/src/app/logs/usecases/create-log/create-log.usecase.ts b/apps/api/src/app/logs/usecases/create-log/create-log.usecase.ts index 28af050ed69..4ab86e432e0 100644 --- a/apps/api/src/app/logs/usecases/create-log/create-log.usecase.ts +++ b/apps/api/src/app/logs/usecases/create-log/create-log.usecase.ts @@ -14,7 +14,7 @@ export class CreateLog { try { rawData = JSON.stringify(command.raw); } catch (error) { - Logger.error('Parsing raw data when creating a log failed', error, LOG_CONTEXT); + Logger.error(error, 'Parsing raw data when creating a log failed', LOG_CONTEXT); } } diff --git a/apps/inbound-mail/src/server/index.ts b/apps/inbound-mail/src/server/index.ts index ef0a07c2202..d4ae07c395f 100644 --- a/apps/inbound-mail/src/server/index.ts +++ b/apps/inbound-mail/src/server/index.ts @@ -220,7 +220,7 @@ class Mailin extends events.EventEmitter { .then(postQueue.bind(null, connection)) .then(unlinkFile.bind(null, connection)) .catch(function (error) { - logger.error(connection.id + ' Unable to finish processing message!!', error); + logger.error(error, connection.id + ' Unable to finish processing message!!'); logger.error(error); throw error; }); diff --git a/apps/worker/src/app/shared/logs/create-log.usecase.ts b/apps/worker/src/app/shared/logs/create-log.usecase.ts index e6367de901d..7ca41977192 100644 --- a/apps/worker/src/app/shared/logs/create-log.usecase.ts +++ b/apps/worker/src/app/shared/logs/create-log.usecase.ts @@ -15,7 +15,7 @@ export class CreateLog { try { rawData = JSON.stringify(command.raw); } catch (error) { - Logger.error('Parsing raw data when creating a log failed', error, LOG_CONTEXT); + Logger.error(error, 'Parsing raw data when creating a log failed', LOG_CONTEXT); } } diff --git a/apps/worker/src/app/workflow/services/metric-queue.service.ts b/apps/worker/src/app/workflow/services/metric-queue.service.ts index e053a80ceb0..a4db82e1d01 100644 --- a/apps/worker/src/app/workflow/services/metric-queue.service.ts +++ b/apps/worker/src/app/workflow/services/metric-queue.service.ts @@ -74,7 +74,7 @@ export class MetricQueueService extends QueueService> { return undefined; }) - .catch((error) => Logger.error('Metric Job Exists function errored', error, LOG_CONTEXT)); + .catch((error) => Logger.error(error, 'Metric Job Exists function errored', LOG_CONTEXT)); } private getWorkerOptions(): WorkerOptions { diff --git a/apps/worker/src/app/workflow/services/workflow-queue.service.ts b/apps/worker/src/app/workflow/services/workflow-queue.service.ts index 3931b16dad3..faebcf9916b 100644 --- a/apps/worker/src/app/workflow/services/workflow-queue.service.ts +++ b/apps/worker/src/app/workflow/services/workflow-queue.service.ts @@ -83,7 +83,7 @@ export class WorkflowQueueService extends QueueService implements INov .then(resolve) .catch((error) => { - Logger.error(`Failed to run the job ${jobId} during worker processing`, error, LOG_CONTEXT); + Logger.error(error, `Failed to run the job ${jobId} during worker processing`, LOG_CONTEXT); return reject(error); }) @@ -113,7 +113,7 @@ export class WorkflowQueueService extends QueueService implements INov }) ); } catch (error) { - Logger.error(`Failed to set job ${jobId} as completed`, error, LOG_CONTEXT); + Logger.error(error, `Failed to set job ${jobId} as completed`, LOG_CONTEXT); } } @@ -155,7 +155,7 @@ export class WorkflowQueueService extends QueueService implements INov await this.handleLastFailedJob.execute(handleLastFailedJobCommand); } } catch (anotherError) { - Logger.error(`Failed to set job ${jobId} as failed`, anotherError, LOG_CONTEXT); + Logger.error(anotherError, `Failed to set job ${jobId} as failed`, LOG_CONTEXT); } } diff --git a/apps/worker/src/app/workflow/usecases/send-message/send-message-chat.usecase.ts b/apps/worker/src/app/workflow/usecases/send-message/send-message-chat.usecase.ts index 2e5487abe8c..3c3d6c55bb0 100644 --- a/apps/worker/src/app/workflow/usecases/send-message/send-message-chat.usecase.ts +++ b/apps/worker/src/app/workflow/usecases/send-message/send-message-chat.usecase.ts @@ -125,7 +125,7 @@ export class SendMessageChat extends SendMessageBase { * Do nothing, one chat channel failed, perhaps another one succeeds * The failed message has been created */ - Logger.error(`Sending chat message to the chat channel ${channel.providerId} failed`, e, LOG_CONTEXT); + Logger.error(e, `Sending chat message to the chat channel ${channel.providerId} failed`, LOG_CONTEXT); } } diff --git a/apps/worker/src/app/workflow/usecases/webhook-filter-backoff-strategy/webhook-filter-backoff-strategy.usecase.ts b/apps/worker/src/app/workflow/usecases/webhook-filter-backoff-strategy/webhook-filter-backoff-strategy.usecase.ts index f0f51f5a06e..4e1ac631bfd 100644 --- a/apps/worker/src/app/workflow/usecases/webhook-filter-backoff-strategy/webhook-filter-backoff-strategy.usecase.ts +++ b/apps/worker/src/app/workflow/usecases/webhook-filter-backoff-strategy/webhook-filter-backoff-strategy.usecase.ts @@ -25,7 +25,11 @@ export class WebhookFilterBackoffStrategy { }) ); } catch (anotherError) { - Logger.error('Failed to create the execution details for backoff stategy', anotherError); + Logger.error( + anotherError, + 'Failed to create the execution details for backoff strategy', + 'WebhookFilterBackoffStrategy' + ); } return Math.round(Math.random() * Math.pow(2, attemptsMade) * 1000); diff --git a/apps/ws/src/socket/services/socket-queue-consumer.service.ts b/apps/ws/src/socket/services/socket-queue-consumer.service.ts index 45f6de90cdc..88742247d22 100644 --- a/apps/ws/src/socket/services/socket-queue-consumer.service.ts +++ b/apps/ws/src/socket/services/socket-queue-consumer.service.ts @@ -26,7 +26,7 @@ export class SocketQueueConsumerService { ); } catch (e) { // eslint-disable-next-line no-console - Logger.error('Unexpected exception occurred while handling external services route ', e, this.LOG_CONTEXT); + Logger.error(e, 'Unexpected exception occurred while handling external services route ', this.LOG_CONTEXT); throw e; } diff --git a/packages/application-generic/src/services/analytics.service.ts b/packages/application-generic/src/services/analytics.service.ts index 295e7d1ad5e..f91112773a7 100644 --- a/packages/application-generic/src/services/analytics.service.ts +++ b/packages/application-generic/src/services/analytics.service.ts @@ -116,12 +116,12 @@ export class AnalyticsService { }); } catch (error: any) { Logger.error( - 'There has been an error when tracking', { eventName: name, usedId: userId, message: error.message, }, + 'There has been an error when tracking', LOG_CONTEXT ); } diff --git a/packages/application-generic/src/services/cache/cache.service.ts b/packages/application-generic/src/services/cache/cache.service.ts index acba382302f..394ddcff276 100644 --- a/packages/application-generic/src/services/cache/cache.service.ts +++ b/packages/application-generic/src/services/cache/cache.service.ts @@ -144,8 +144,8 @@ export class CacheService implements ICacheService { await pipeline.exec(); } catch (error) { Logger.error( - `Failed to execute pipeline action ${action} for key ${key}`, error, + `Failed to execute pipeline action ${action} for key ${key}`, LOG_CONTEXT ); throw error; diff --git a/packages/application-generic/src/services/cache/interceptors/cached-entity.interceptor.ts b/packages/application-generic/src/services/cache/interceptors/cached-entity.interceptor.ts index 0bfedc72e18..feda69439bd 100644 --- a/packages/application-generic/src/services/cache/interceptors/cached-entity.interceptor.ts +++ b/packages/application-generic/src/services/cache/interceptors/cached-entity.interceptor.ts @@ -37,8 +37,8 @@ export function CachedEntity({ } } catch (err) { Logger.error( - `An error has occurred when extracting "key: ${cacheKey}" in "method: ${methodName}"`, err, + `An error has occurred when extracting "key: ${cacheKey}" in "method: ${methodName}"`, LOG_CONTEXT ); } @@ -50,8 +50,8 @@ export function CachedEntity({ } catch (err) { // eslint-disable-next-line no-console Logger.error( - `An error has occurred when inserting "key: ${cacheKey}" in "method: ${methodName}" with "value: ${response}"`, err, + `An error has occurred when inserting key: ${cacheKey} in "method: ${methodName}`, LOG_CONTEXT ); } diff --git a/packages/application-generic/src/services/cache/interceptors/cached-query.interceptor.ts b/packages/application-generic/src/services/cache/interceptors/cached-query.interceptor.ts index 33307c7ce50..392f635f279 100644 --- a/packages/application-generic/src/services/cache/interceptors/cached-query.interceptor.ts +++ b/packages/application-generic/src/services/cache/interceptors/cached-query.interceptor.ts @@ -32,8 +32,8 @@ export function CachedQuery({ builder }: { builder: (...args) => string }) { } } catch (err) { Logger.error( - `An error has occurred when extracting "key: ${cacheKey}" in "method: ${methodName}"`, err, + `An error has occurred when extracting "key: ${cacheKey}" in "method: ${methodName}"`, LOG_CONTEXT ); } @@ -44,8 +44,8 @@ export function CachedQuery({ builder }: { builder: (...args) => string }) { await cacheService.setQuery(cacheKey, JSON.stringify(response)); } catch (err) { Logger.error( - `An error has occurred when inserting "key: ${cacheKey}" in "method: ${methodName}" with "value: ${response}"`, err, + `An error has occurred when inserting key: ${cacheKey} in method: ${methodName}`, LOG_CONTEXT ); } diff --git a/packages/application-generic/src/services/cache/interceptors/cached.interceptor.ts b/packages/application-generic/src/services/cache/interceptors/cached.interceptor.ts index 41f384f1b60..4018f3ee156 100644 --- a/packages/application-generic/src/services/cache/interceptors/cached.interceptor.ts +++ b/packages/application-generic/src/services/cache/interceptors/cached.interceptor.ts @@ -42,8 +42,8 @@ export function Cached(storeKeyPrefix: CacheKeyPrefixEnum) { } } catch (err) { Logger.error( - `An error has occurred when extracting "key: ${cacheKey}" in "method: ${methodName}"`, err, + `An error has occurred when extracting "key: ${cacheKey}" in "method: ${methodName}"`, LOG_CONTEXT ); } @@ -54,8 +54,8 @@ export function Cached(storeKeyPrefix: CacheKeyPrefixEnum) { await this.cacheService.set(cacheKey, JSON.stringify(response)); } catch (err) { Logger.error( - `An error has occurred when inserting "key: ${cacheKey}" in "method: ${methodName}" with "value: ${response}"`, err, + `An error has occurred when inserting key: ${cacheKey} in "method: ${methodName}`, LOG_CONTEXT ); } diff --git a/packages/application-generic/src/services/cache/invalidate-cache.service.ts b/packages/application-generic/src/services/cache/invalidate-cache.service.ts index 6f290040705..470427b8379 100644 --- a/packages/application-generic/src/services/cache/invalidate-cache.service.ts +++ b/packages/application-generic/src/services/cache/invalidate-cache.service.ts @@ -20,8 +20,8 @@ export class InvalidateCacheService { await this.cacheService.del(key); } catch (err) { Logger.error( - `An error has occurred when deleting "key: ${key}",`, err, + `An error has occurred when deleting "key: ${key}",`, LOG_CONTEXT ); } @@ -34,8 +34,8 @@ export class InvalidateCacheService { await this.cacheService.delQuery(key); } catch (err) { Logger.error( - `An error has occurred when deleting "key: ${key}",`, err, + `An error has occurred when deleting "key: ${key}",`, LOG_CONTEXT ); } @@ -66,8 +66,8 @@ export class InvalidateCacheService { Logger.verbose('Finished cache delete by pattern'); } catch (err) { Logger.error( - `An error has occurred when deleting "key: ${cacheKey}",`, err, + `An error has occurred when deleting "key: ${cacheKey}",`, LOG_CONTEXT ); } diff --git a/packages/application-generic/src/services/distributed-lock/distributed-lock.service.ts b/packages/application-generic/src/services/distributed-lock/distributed-lock.service.ts index 9beb4024596..85e3085ab12 100644 --- a/packages/application-generic/src/services/distributed-lock/distributed-lock.service.ts +++ b/packages/application-generic/src/services/distributed-lock/distributed-lock.service.ts @@ -58,8 +58,8 @@ export class DistributedLockService { */ this.distributedLock.on('error', (error) => { Logger.error( - 'There has been an error in the Distributed Lock service', error, + 'There has been an error in the Distributed Lock service', LOG_CONTEXT ); }); diff --git a/packages/application-generic/src/services/feature-flags.service.ts b/packages/application-generic/src/services/feature-flags.service.ts index 24af6387029..5e48ab0e766 100644 --- a/packages/application-generic/src/services/feature-flags.service.ts +++ b/packages/application-generic/src/services/feature-flags.service.ts @@ -52,8 +52,8 @@ export class FeatureFlagsService { ); } catch (error) { Logger.error( - 'Feature Flags service has failed when shut down', error, + 'Feature Flags service has failed when shut down', LOG_CONTEXT ); } @@ -98,8 +98,8 @@ export class FeatureFlagsService { ); } catch (error) { Logger.error( - 'Feature Flags service has failed when initialized', error, + 'Feature Flags service has failed when initialized', LOG_CONTEXT ); } diff --git a/packages/application-generic/src/services/in-memory-provider/in-memory-provider.service.ts b/packages/application-generic/src/services/in-memory-provider/in-memory-provider.service.ts index c5bbb291a79..796cfc6ccbc 100644 --- a/packages/application-generic/src/services/in-memory-provider/in-memory-provider.service.ts +++ b/packages/application-generic/src/services/in-memory-provider/in-memory-provider.service.ts @@ -173,8 +173,8 @@ export class InMemoryProviderService { }); } catch (e) { Logger.error( - 'Connecting to cluster executing intervals has failed', e, + 'Connecting to cluster executing intervals has failed', LOG_CONTEXT ); } @@ -202,8 +202,8 @@ export class InMemoryProviderService { inMemoryProviderClient.on('error', (error) => { Logger.error( - 'There has been an error in the InMemory Cluster provider client', error, + 'There has been an error in the InMemory Cluster provider client', LOG_CONTEXT ); }); @@ -252,8 +252,8 @@ export class InMemoryProviderService { inMemoryProviderClient.on('error', (error) => { Logger.error( - 'There has been an error in the InMemory provider client', error, + 'There has been an error in the InMemory provider client', LOG_CONTEXT ); }); diff --git a/packages/application-generic/src/services/launch-darkly.service.ts b/packages/application-generic/src/services/launch-darkly.service.ts index 77ad3a4fe2b..a8d281709c0 100644 --- a/packages/application-generic/src/services/launch-darkly.service.ts +++ b/packages/application-generic/src/services/launch-darkly.service.ts @@ -42,8 +42,8 @@ export class LaunchDarklyService implements IFeatureFlagsService { ); } catch (error) { Logger.error( - 'Launch Darkly SDK has failed when initialized', error, + 'Launch Darkly SDK has failed when initialized', LOG_CONTEXT ); throw error; @@ -98,8 +98,8 @@ export class LaunchDarklyService implements IFeatureFlagsService { ); } catch (error) { Logger.error( - 'Launch Darkly SDK has failed when shut down', error, + 'Launch Darkly SDK has failed when shut down', LOG_CONTEXT ); throw error; diff --git a/packages/application-generic/src/services/readiness.service.ts b/packages/application-generic/src/services/readiness.service.ts index 60e27cbc016..332f262ecc6 100644 --- a/packages/application-generic/src/services/readiness.service.ts +++ b/packages/application-generic/src/services/readiness.service.ts @@ -39,8 +39,8 @@ export class ReadinessService { return healths.every((health) => !!health === true); } catch (error) { Logger.error( - 'Some health indicator throw an error when checking if queues are enabled', error, + 'Some health indicator throw an error when checking if queues are enabled', LOG_CONTEXT ); diff --git a/packages/application-generic/src/usecases/create-notification-jobs/create-notification-jobs.usecase.ts b/packages/application-generic/src/usecases/create-notification-jobs/create-notification-jobs.usecase.ts index 3418ca0856f..63f09a971cf 100644 --- a/packages/application-generic/src/usecases/create-notification-jobs/create-notification-jobs.usecase.ts +++ b/packages/application-generic/src/usecases/create-notification-jobs/create-notification-jobs.usecase.ts @@ -66,7 +66,7 @@ export class CreateNotificationJobs { if (!notification) { const message = 'Notification could not be created'; const error = new PlatformException(message); - Logger.error(message, error, LOG_CONTEXT); + Logger.error(error, message, LOG_CONTEXT); throw error; } diff --git a/packages/application-generic/src/usecases/digest-filter-steps/digest-filter-steps.usecase.ts b/packages/application-generic/src/usecases/digest-filter-steps/digest-filter-steps.usecase.ts index 8938a82a7b2..fded30801f9 100644 --- a/packages/application-generic/src/usecases/digest-filter-steps/digest-filter-steps.usecase.ts +++ b/packages/application-generic/src/usecases/digest-filter-steps/digest-filter-steps.usecase.ts @@ -75,8 +75,8 @@ export class DigestFilterSteps { return result; } catch (error) { Logger.error( - 'Failure when parsing digest payload nested key', error, + 'Failure when parsing digest payload nested key', LOG_CONTEXT ); diff --git a/packages/application-generic/src/usecases/trigger-event/trigger-event.usecase.ts b/packages/application-generic/src/usecases/trigger-event/trigger-event.usecase.ts index e7bbe3a2cd0..d5ae074a333 100644 --- a/packages/application-generic/src/usecases/trigger-event/trigger-event.usecase.ts +++ b/packages/application-generic/src/usecases/trigger-event/trigger-event.usecase.ts @@ -89,7 +89,7 @@ export class TriggerEvent { if (!template) { const message = 'Notification template could not be found'; const error = new ApiException(message); - Logger.error(message, error, LOG_CONTEXT); + Logger.error(error, message, LOG_CONTEXT); throw error; }