refactor: migrate discord-gateway from winston to @bete/shared/logger and utils
- Replace all local logger imports (../../shared/logger/logger.js) with @bete/shared/logger across 26 files - Remove winston dependency, add pino to discord-gateway package.json - Delete shared/logger/logger.ts (winston-based, 132 lines) and serialization.ts (109 lines) - Replace local retryWithBackoff imports with @bete/shared/utils across 6 files - Delete shared/utils/retry.ts (42 lines) - Add CustomLogger type alias to @bete/shared/logger for backwards compatibility - Remove logger param from all retryWithBackoff calls and uploadToTele interfaces - Frontend: convert entity type files to re-exports from shared/api/client.ts - Full monorepo typecheck clean (4/4 packages) 35 files changed, 42 insertions(+), 488 deletions(-)
This commit is contained in:
@@ -4,8 +4,8 @@ import type { Client } from "discord.js-selfbot-v13";
|
||||
import { AbortError } from "p-retry";
|
||||
import { Piscina } from "piscina";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { createChildLogger } from "../../shared/logger/logger.js";
|
||||
import { retryWithBackoff } from "../../shared/utils/retry.js";
|
||||
import { createChildLogger } from "@bete/shared/logger";
|
||||
import { retryWithBackoff } from "@bete/shared/utils";
|
||||
import type { EventBroadcaster } from "../event-broadcaster/index.js";
|
||||
import { invalidateAnalyticsCache } from "../message-capture/analyticsStore.js";
|
||||
import { isAgeRestrictedMetadata } from "../message-capture/messageMetadata.js";
|
||||
@@ -380,7 +380,6 @@ async function processIndividualFallback(
|
||||
retries: 0,
|
||||
minTimeout: 0,
|
||||
maxTimeout: 0,
|
||||
logger,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Client, PermissionString } from "discord.js-selfbot-v13";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { createChildLogger } from "../../shared/logger/logger.js";
|
||||
import { createChildLogger } from "@bete/shared/logger";
|
||||
import { createModerationAction } from "../message-capture/messageStore.js";
|
||||
import type { MessageRecord } from "../message-capture/types.js";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createChildLogger } from "../../shared/logger/logger.js";
|
||||
import { createChildLogger } from "@bete/shared/logger";
|
||||
import { getCachedText, upsertCachedText } from "./textCacheStore.js";
|
||||
import { llmDetectBadwords } from "./llmClient.js";
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
|
||||
import OpenAI from "openai";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { retryWithBackoff } from "../../shared/utils/retry.js";
|
||||
import { retryWithBackoff } from "@bete/shared/utils";
|
||||
import { withLlmConcurrency } from "./concurrencyLimiter.js";
|
||||
import { createChildLogger } from "../../shared/logger/logger.js";
|
||||
import { createChildLogger } from "@bete/shared/logger";
|
||||
|
||||
const log = createChildLogger("llm-client");
|
||||
|
||||
@@ -136,7 +136,6 @@ export async function llmChat(
|
||||
minTimeout: 0,
|
||||
maxTimeout: 0,
|
||||
factor: 2,
|
||||
logger: log,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ import type { ChatCompletion } from "openai/resources/chat/completions";
|
||||
import { AbortError } from "p-retry";
|
||||
import { z } from "zod";
|
||||
import { config } from "../../shared/config/config.js";
|
||||
import { createChildLogger } from "../../shared/logger/logger.js";
|
||||
import { retryWithBackoff } from "../../shared/utils/retry.js";
|
||||
import { createChildLogger } from "@bete/shared/logger";
|
||||
import { retryWithBackoff } from "@bete/shared/utils";
|
||||
import { resizeImageForVision } from "../attachment-upload/imageResizer.js";
|
||||
import { extractMessageMediaEvidence } from "../message-capture/messageMetadata.js";
|
||||
import type {
|
||||
@@ -677,7 +677,6 @@ async function callModerationLLM(
|
||||
minTimeout: 3000,
|
||||
maxTimeout: 8000,
|
||||
factor: 2,
|
||||
logger: log,
|
||||
},
|
||||
);
|
||||
parsed = analysis.parsed;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* Enables full audit trail and debugging of moderation decisions.
|
||||
*/
|
||||
|
||||
import { createChildLogger } from "../../shared/logger/logger.js";
|
||||
import { createChildLogger } from "@bete/shared/logger";
|
||||
import type { AnalysisResult } from "../message-capture/types.js";
|
||||
|
||||
const logger = createChildLogger("response-logger");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { executeAll, executeGet } from "../../shared/database/drizzle.js";
|
||||
import { createChildLogger } from "../../shared/logger/logger.js";
|
||||
import { createChildLogger } from "@bete/shared/logger";
|
||||
|
||||
const logger = createChildLogger("sticker-cache");
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import { executeAll, executeGet } from "../../shared/database/drizzle.js";
|
||||
import { createChildLogger } from "../../shared/logger/logger.js";
|
||||
import { createChildLogger } from "@bete/shared/logger";
|
||||
|
||||
const logger = createChildLogger("text-cache-store");
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { resolve } from "node:dns/promises";
|
||||
import { isIP } from "node:net";
|
||||
import { createChildLogger } from "../../shared/logger/logger.js";
|
||||
import { createChildLogger } from "@bete/shared/logger";
|
||||
|
||||
const log = createChildLogger("urlFetcher");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user