chore(server): setup winston logger (#9561)

There is no impact on the existing logger, as the current logger is used with `new Logger(Context)` and does not utilize dependency injection. In the next phase, gradually replace and supplement the existing `Logger`.
This commit is contained in:
Brooooooklyn
2025-01-07 09:15:07 +00:00
parent 5e51018c03
commit 482b534a90
10 changed files with 518 additions and 16 deletions
+6 -3
View File
@@ -1,8 +1,9 @@
import { Injectable, Logger, OnModuleInit, Optional } from '@nestjs/common';
import { Injectable, OnModuleInit, Optional } from '@nestjs/common';
import { Cron, CronExpression, SchedulerRegistry } from '@nestjs/schedule';
import { PrismaClient } from '@prisma/client';
import {
AFFiNELogger,
CallMetric,
Config,
type EventPayload,
@@ -13,15 +14,17 @@ import { PgWorkspaceDocStorageAdapter } from './adapters/workspace';
@Injectable()
export class DocStorageCronJob implements OnModuleInit {
private readonly logger = new Logger(DocStorageCronJob.name);
private busy = false;
constructor(
private readonly config: Config,
private readonly db: PrismaClient,
private readonly workspace: PgWorkspaceDocStorageAdapter,
private readonly logger: AFFiNELogger,
@Optional() private readonly registry?: SchedulerRegistry
) {}
) {
this.logger.setContext(DocStorageCronJob.name);
}
onModuleInit() {
if (this.registry && this.config.doc.manager.enableUpdateAutoMerging) {