Skip to content

The open alternative to Salesforce, designed for AI.

chore(server): remove unused `CommandLogger` from command module (#20638)

Anish Paudele463a09e173e
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 994d3848c61..00000000000
--- 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<void> {
- 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<string> {
- 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;
- }
- }
-}