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 <charlesBochet@users.noreply.github.com>
This commit is contained in:
Anish Paudel
2026-05-19 20:29:34 +05:45
committed by GitHub
parent 83b10ad698
commit e463a09e17
@@ -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;
}
}
}