From e463a09e173e1412a340b1ec48fc726b799a515a Mon Sep 17 00:00:00 2001 From: Anish Paudel <32244578+Rpaudel379@users.noreply.github.com> Date: Tue, 19 May 2026 20:29:34 +0545 Subject: [PATCH] chore(server): remove unused `CommandLogger` from command module (#20638) ## Summary This PR removes the unused `CommandLogger` implementation located at: ``` /commands/command-logger.ts ``` The Command application context is bootstrapped using `LoggerService` from: ```ts import { LoggerService } from 'src/engine/core-modules/logger/logger.service'; ... const loggerService = app.get(LoggerService); ... // Inject our logger app.useLogger(loggerService); ... ``` So `CommandLogger` is not imported, injected, or referenced anywhere in the Command execution flow and is safe to remove. ## Note There is another `CommandLogger` class at: ``` /database/commands/logger.ts ``` This one is only used within `database-command` module and is unrelated to the Command module logger being removed in this PR. Co-authored-by: Charles Bochet --- .../src/command/command-logger.ts | 53 ------------------- 1 file changed, 53 deletions(-) delete mode 100644 packages/twenty-server/src/command/command-logger.ts diff --git a/packages/twenty-server/src/command/command-logger.ts b/packages/twenty-server/src/command/command-logger.ts deleted file mode 100644 index 994d3848c6..0000000000 --- a/packages/twenty-server/src/command/command-logger.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* oxlint-disable no-console */ -import { Injectable } from '@nestjs/common'; - -import { existsSync } from 'fs'; -import fs from 'fs/promises'; -import { join as joinPath } from 'path'; - -import { kebabCase } from 'src/utils/kebab-case'; - -@Injectable() -export class CommandLogger { - constructor(private readonly className: string) {} - - async createSubDirectory(subDirectory: string): Promise { - const path = `./logs/${kebabCase(this.className)}/${subDirectory}`; - - if (existsSync(path) === false) { - await fs.mkdir(path, { recursive: true }); - } - - return; - } - - async writeLog( - fileName: string, - data: unknown, - append = false, - ): Promise { - const path = `./logs/${kebabCase(this.className)}`; - - if (existsSync(path) === false) { - await fs.mkdir(path, { recursive: true }); - } - - try { - const logFilePath = `${path}/${fileName}.json`; - - await fs.writeFile(logFilePath, JSON.stringify(data, null, 2), { - flag: append ? 'a' : 'w', - }); - - const absoluteLogFilePath = joinPath(process.cwd(), logFilePath); - - return absoluteLogFilePath; - } catch (err) { - console.error( - `Error writing to file ${path}/${fileName}.json: ${err?.message}`, - ); - - throw err; - } - } -}