diff --git a/api/logger.config.ts b/api/logger.config.ts index 5fc79de1..2f3d9c4f 100644 --- a/api/logger.config.ts +++ b/api/logger.config.ts @@ -3,7 +3,6 @@ import { LoggerConfig } from './src/types'; export const defaultLoggerConfig: LoggerConfig = { // Filter by module name moduleFilter: [], - debugModules: [], // Filter by log prefix, e.g. adding // `pref` to filter is going to correspond to showing `[PREF] ` logs prefixFilter: [], @@ -17,8 +16,7 @@ export const defaultLoggerConfig: LoggerConfig = { export const debugLogConfig: LoggerConfig = { // Filter by module name - moduleFilter: [], - debugModules: [], + moduleFilter: ["RWA Internal Listener"], // Filter by log prefix, e.g. adding // `pref` to filter is going to correspond to showing `[PERF]` logs prefixFilter: [], diff --git a/api/src/logger.ts b/api/src/logger.ts index 479461c0..89fd6ee4 100644 --- a/api/src/logger.ts +++ b/api/src/logger.ts @@ -34,8 +34,8 @@ const filterModule = (config: { return true; } const { bindings } = config; - const { module: mod } = bindings; - if (mod && moduleFilter.includes(mod)) { + const { moduleName } = bindings; + if (moduleName && moduleFilter.includes(moduleName)) { return true; } return false; diff --git a/api/src/modules/real-world-assets/listener.ts b/api/src/modules/real-world-assets/listener.ts index e24a1e85..a8c254a3 100644 --- a/api/src/modules/real-world-assets/listener.ts +++ b/api/src/modules/real-world-assets/listener.ts @@ -5,7 +5,7 @@ import { CashGroupTransactionType, CreateFixedIncomeAssetInput, EditFixedIncomeA import { getChildLogger } from "../../logger"; import { Action } from "document-model/document"; -const logger = getChildLogger({ msgPrefix: 'RWA Internal Listener' }); +const logger = getChildLogger({ msgPrefix: 'RWA Internal Listener' }, { moduleName: "RWA Internal Listener" }); export interface IReceiverOptions { listenerId: string; label: string; @@ -27,7 +27,7 @@ export const listener: IReceiverOptions = { export async function transmit(strands: InternalTransmitterUpdate[], prisma: Prisma.TransactionClient) { - // logger.info(strands); + // logger.debug(strands); for (const strand of strands) { if (strand.documentId === "") { @@ -35,16 +35,13 @@ export async function transmit(strands: InternalTransmitterUpdate, prisma); } - - - } } async function handleDriveStrand(strand: InternalTransmitterUpdate, prisma: Prisma.TransactionClient) { - logger.info("Received strand for drive"); + logger.debug("Received strand for drive"); if (strandStartsFromOpZero(strand)) { await deleteDriveState(strand.state, prisma); } @@ -54,13 +51,13 @@ async function handleDriveStrand(strand: InternalTransmitterUpdate) { const resetNeeded = strand.operations.length > 0 && strand.operations[0].index === 0; - logger.info(`Reset needed: ${resetNeeded}`); + logger.debug(`Reset needed: ${resetNeeded}`); return resetNeeded; } async function doSurgicalDriveUpdate(strand: InternalTransmitterUpdate, prisma: Prisma.TransactionClient) { - logger.info("Doing surgical drive update"); + logger.debug("Doing surgical drive update"); for (const operation of strand.operations) { - logger.info(`Operation: ${operation.type}`); + logger.debug(`Operation: ${operation.type}`); switch (operation.type) { case "ADD_FILE": const addFileInput = operation.input as AddFileInput; @@ -72,14 +69,14 @@ async function doSurgicalDriveUpdate(strand: InternalTransmitterUpdate, prisma: Prisma.TransactionClient) { - logger.info(`Received strand for document ${strand.documentId} with operations: ${strand.operations.map(op => op.type).join(", ")}`); + logger.debug(`Received strand for document ${strand.documentId} with operations: ${strand.operations.map(op => op.type).join(", ")}`); if (!await rwaPortfolioExists(strand.driveId, strand.documentId, prisma)) { - logger.info(`Skipping strand for document ${strand.documentId} as it doesn't exist in the read model`); + logger.debug(`Skipping strand for document ${strand.documentId} as it doesn't exist in the read model`); return; } @@ -261,15 +258,14 @@ async function handleRwaDocumentStrand(strand: InternalTransmitterUpdate, surgicalOperations: Record void>) { const allOperationsAreSurgical = strand.operations.filter(op => surgicalOperations[op.type] === undefined).length === 0; - logger.info(`All operations are surgical: ${allOperationsAreSurgical}`); + logger.debug(`All operations are surgical: ${allOperationsAreSurgical}`); return allOperationsAreSurgical } diff --git a/api/src/types.d.ts b/api/src/types.d.ts index 33076f3c..7bd5857f 100644 --- a/api/src/types.d.ts +++ b/api/src/types.d.ts @@ -3,7 +3,6 @@ import { Prisma } from '@prisma/client'; export declare interface LoggerConfig { moduleFilter: string[]; - debugModules: [], prefixFilter: string[]; logLevel: PinoLevel; dbLogLevel: Prisma.LogLevel[];