feat(core): Introduce scoped logging (#11127)

This commit is contained in:
Iván Ovejero
2024-10-09 12:56:31 +02:00
committed by GitHub
parent 518e320404
commit c68782c633
23 changed files with 221 additions and 122 deletions

View File

@@ -4,6 +4,8 @@ import type { Class } from 'n8n-core';
import type { DeepPartial } from 'ts-essentials';
import { Container } from 'typedi';
import type { Logger } from '@/logging/logger.service';
export const mockInstance = <T>(
serviceClass: Class<T>,
data: DeepPartial<T> | undefined = undefined,
@@ -22,3 +24,6 @@ export const mockEntityManager = (entityClass: Class) => {
Object.assign(entityManager, { connection: dataSource });
return entityManager;
};
export const mockLogger = () =>
mock<Logger>({ withScope: jest.fn().mockReturnValue(mock<Logger>()) });