From f23b1fc802de5512a9219bf8654e29c1df832996 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 7 Nov 2023 06:44:56 +0000 Subject: [PATCH] refactor: use error method for logging error --- .../src/filters/global-exception/global-exception.filter.ts | 2 +- packages/nocodb/src/helpers/webhookHelpers.ts | 4 ++-- packages/nocodb/src/services/datas.service.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nocodb/src/filters/global-exception/global-exception.filter.ts b/packages/nocodb/src/filters/global-exception/global-exception.filter.ts index 1933b66e08..bb191405dc 100644 --- a/packages/nocodb/src/filters/global-exception/global-exception.filter.ts +++ b/packages/nocodb/src/filters/global-exception/global-exception.filter.ts @@ -46,7 +46,7 @@ export class GlobalExceptionFilter implements ExceptionFilter { this.logError(exception, request); if (exception instanceof ThrottlerException) { - this.logger.log( + this.logger.warn( `${exception.message}, Path : ${request.path}, Workspace ID : ${ (request as any).ncWorkspaceId }, Project ID : ${(request as any).ncProjectId}`, diff --git a/packages/nocodb/src/helpers/webhookHelpers.ts b/packages/nocodb/src/helpers/webhookHelpers.ts index 6ce9fa32a5..ad437476aa 100644 --- a/packages/nocodb/src/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/helpers/webhookHelpers.ts @@ -413,14 +413,14 @@ export async function invokeWebhook( } } catch (e) { if (e.response) { - logger.log({ + logger.error({ data: e.response.data, status: e.response.status, url: e.response.config?.url, message: e.message, }); } else { - logger.log(e.message, e.stack); + logger.error(e.message, e.stack); } if (['ERROR', 'ALL'].includes(process.env.NC_AUTOMATION_LOG_LEVEL)) { hookLog = { diff --git a/packages/nocodb/src/services/datas.service.ts b/packages/nocodb/src/services/datas.service.ts index fbbc4ee5db..a20a8bb034 100644 --- a/packages/nocodb/src/services/datas.service.ts +++ b/packages/nocodb/src/services/datas.service.ts @@ -180,7 +180,7 @@ export class DatasService { ); } catch (e) { if (e instanceof NcBaseError) throw e; - this.logger.log(e); + this.logger.error(e); NcError.internalServerError( 'Please check server log for more details', );