From 5d186023c1d5076f0a72c931a946f5d1bacd8896 Mon Sep 17 00:00:00 2001 From: Alexander Weber Date: Wed, 22 Nov 2023 13:51:40 +0100 Subject: [PATCH] switched to enum --- src/core/logging/class-logger.spec.ts | 2 +- src/shared/config/logging.config.ts | 32 +++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/core/logging/class-logger.spec.ts b/src/core/logging/class-logger.spec.ts index c8c6d1d6e..e98a4d62d 100644 --- a/src/core/logging/class-logger.spec.ts +++ b/src/core/logging/class-logger.spec.ts @@ -1,7 +1,7 @@ import { DeepMocked, createMock } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { Logger } from 'winston'; -import { ConfigTestModule } from '../../../test/utils/config-test.module.js'; +import { ConfigTestModule } from '../../../test/utils/index.js'; import { ClassLogger } from './class-logger.js'; import { LoggerModule } from './logger.module.js'; import { ModuleLogger } from './module-logger.js'; diff --git a/src/shared/config/logging.config.ts b/src/shared/config/logging.config.ts index c1c572899..d95876fb5 100644 --- a/src/shared/config/logging.config.ts +++ b/src/shared/config/logging.config.ts @@ -1,55 +1,55 @@ -import { IsNotEmpty, IsOptional, IsString } from 'class-validator'; +import { IsEnum, IsNotEmpty, IsOptional } from 'class-validator'; + +const ALLOWED_VALUES: string[] = ['debug', 'info', 'warn', 'notice', 'warning', 'error', 'crit', 'alert', 'emerg']; export class LoggingConfig { - @IsString() + @IsNotEmpty() + @IsEnum(ALLOWED_VALUES) public readonly DEFAULT_LOG_LEVEL!: string; //Domain Modules @IsOptional() - @IsString() + @IsEnum(ALLOWED_VALUES) public readonly PERSON_MODULE_LOG_LEVEL?: string; @IsOptional() - @IsString() + @IsEnum(ALLOWED_VALUES) public readonly ORGANISATION_MODULE_LOG_LEVEL?: string; @IsOptional() - @IsString() + @IsEnum(ALLOWED_VALUES) public readonly ROLLE_MODULE_LOG_LEVEL?: string; //API Modules - @IsOptional() - @IsString() - public readonly PERSON_API_MODULE_LOG_LEVEL?: string; @IsOptional() - @IsString() - public readonly ORGANISATION_API_MODULE_LOG_LEVEL?: string; + @IsEnum(ALLOWED_VALUES) + public readonly PERSON_API_MODULE_LOG_LEVEL!: string; @IsOptional() - @IsString() + @IsEnum(ALLOWED_VALUES) public readonly ROLLE_API_MODULE_LOG_LEVEL?: string; //Technical Modules @IsOptional() - @IsString() + @IsEnum(ALLOWED_VALUES) public readonly SERVER_MODULE_LOG_LEVEL?: string; @IsOptional() - @IsString() + @IsEnum(ALLOWED_VALUES) public readonly KEYCLOAK_ADMINISTRATION_MODULE_LOG_LEVEL?: string; @IsOptional() - @IsString() + @IsEnum(ALLOWED_VALUES) public readonly HEALTH_MODULE_LOG_LEVEL?: string; //SPSH Modules @IsOptional() - @IsString() + @IsEnum(ALLOWED_VALUES) public readonly BACKEND_FOR_FRONTEND_MODULE_LOG_LEVEL?: string; - @IsString() @IsOptional() + @IsEnum(ALLOWED_VALUES) public readonly UI_BACKEND_MODULE_LOG_LEVEL?: string; }