From d83400bec520136a5144609197a7ceda4b761e6c Mon Sep 17 00:00:00 2001 From: Lucas Bordeau Date: Thu, 14 Nov 2024 17:17:34 +0100 Subject: [PATCH] Fixed logging --- .../query-result-getters.factory.ts | 13 +++++++------ .../workspace-query-runner.module.ts | 2 -- .../src/engine/core-modules/logger/logger.module.ts | 6 +++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/query-result-getters.factory.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/query-result-getters.factory.ts index 0cf30a4339e7..0ed6b8f7f23a 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/query-result-getters.factory.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/query-result-getters.factory.ts @@ -1,4 +1,4 @@ -import { Injectable, LoggerService } from '@nestjs/common'; +import { Injectable, Logger } from '@nestjs/common'; import { Record as ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface'; import { QueryResultFieldValue } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/interfaces/query-result-field-value'; @@ -15,6 +15,7 @@ import { isQueryResultFieldValueAConnection } from 'src/engine/api/graphql/works import { isQueryResultFieldValueANestedRecordArray } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-nested-record-array.guard'; import { isQueryResultFieldValueARecordArray } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-record-array.guard'; import { isQueryResultFieldValueARecord } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/utils/is-query-result-field-value-a-record.guard'; +import { CompositeInputTypeDefinitionFactory } from 'src/engine/api/graphql/workspace-schema-builder/factories/composite-input-type-definition.factory'; import { FileService } from 'src/engine/core-modules/file/services/file.service'; import { ObjectMetadataMap } from 'src/engine/metadata-modules/utils/generate-object-metadata-map.util'; import { isRelationFieldMetadataType } from 'src/engine/utils/is-relation-field-metadata-type.util'; @@ -25,12 +26,12 @@ import { isDefined } from 'src/utils/is-defined'; // Right now the factory will override any change made on relations by the handlers @Injectable() export class QueryResultGettersFactory { + private readonly logger = new Logger( + CompositeInputTypeDefinitionFactory.name, + ); private handlers: Map; - constructor( - private readonly fileService: FileService, - private readonly loggerService: LoggerService, - ) { + constructor(private readonly fileService: FileService) { this.initializeHandlers(); } @@ -215,7 +216,7 @@ export class QueryResultGettersFactory { workspaceId, ); } else { - this.loggerService.warn( + this.logger.warn( `Query result field is not a record, connection, nested record array or record array. This is an undetected case in query result getter that should be implemented !!`, ); diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.module.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.module.ts index 8c6083a61e7f..8c348e726ff5 100644 --- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.module.ts +++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.module.ts @@ -11,7 +11,6 @@ import { AuthModule } from 'src/engine/core-modules/auth/auth.module'; import { FeatureFlagEntity } from 'src/engine/core-modules/feature-flag/feature-flag.entity'; import { FeatureFlagModule } from 'src/engine/core-modules/feature-flag/feature-flag.module'; import { FileModule } from 'src/engine/core-modules/file/file.module'; -import { LoggerModule } from 'src/engine/core-modules/logger/logger.module'; import { TelemetryModule } from 'src/engine/core-modules/telemetry/telemetry.module'; import { ObjectMetadataRepositoryModule } from 'src/engine/object-metadata-repository/object-metadata-repository.module'; import { WorkspaceDataSourceModule } from 'src/engine/workspace-datasource/workspace-datasource.module'; @@ -31,7 +30,6 @@ import { EntityEventsToDbListener } from './listeners/entity-events-to-db.listen TelemetryModule, FileModule, FeatureFlagModule, - LoggerModule, ], providers: [ ...workspaceQueryRunnerFactories, diff --git a/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts b/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts index 4822a780b1c4..fba6a3a5fb0b 100644 --- a/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts +++ b/packages/twenty-server/src/engine/core-modules/logger/logger.module.ts @@ -1,13 +1,13 @@ -import { DynamicModule, Global, ConsoleLogger, Module } from '@nestjs/common'; +import { ConsoleLogger, DynamicModule, Global, Module } from '@nestjs/common'; -import { LoggerService } from 'src/engine/core-modules/logger/logger.service'; +import { LoggerDriverType } from 'src/engine/core-modules/logger/interfaces'; import { LOGGER_DRIVER } from 'src/engine/core-modules/logger/logger.constants'; import { ASYNC_OPTIONS_TYPE, ConfigurableModuleClass, OPTIONS_TYPE, } from 'src/engine/core-modules/logger/logger.module-definition'; -import { LoggerDriverType } from 'src/engine/core-modules/logger/interfaces'; +import { LoggerService } from 'src/engine/core-modules/logger/logger.service'; @Global() @Module({