fix: 🔊 Fix logging code to not run in tests

This commit is contained in:
Jesse Wierzbinski 2024-09-23 12:01:02 +02:00
parent c993b7207e
commit 08ce64e9b9
No known key found for this signature in database
3 changed files with 3 additions and 2 deletions

2
app.ts
View file

@ -1,6 +1,5 @@
import { join } from "node:path"; import { join } from "node:path";
import { handleZodError } from "@/api"; import { handleZodError } from "@/api";
import { configureLoggers } from "@/loggers";
import { sentry } from "@/sentry"; import { sentry } from "@/sentry";
import { cors } from "@hono/hono/cors"; import { cors } from "@hono/hono/cors";
import { createMiddleware } from "@hono/hono/factory"; import { createMiddleware } from "@hono/hono/factory";
@ -24,7 +23,6 @@ import { routes } from "./routes";
import type { ApiRouteExports, HonoEnv } from "./types/api"; import type { ApiRouteExports, HonoEnv } from "./types/api";
export const appFactory = async () => { export const appFactory = async () => {
await configureLoggers();
const serverLogger = getLogger("server"); const serverLogger = getLogger("server");
const app = new OpenAPIHono<HonoEnv>({ const app = new OpenAPIHono<HonoEnv>({

BIN
bun.lockb

Binary file not shown.

View file

@ -1,9 +1,12 @@
import cluster from "node:cluster"; import cluster from "node:cluster";
import { configureLoggers } from "@/loggers";
import { sentry } from "@/sentry"; import { sentry } from "@/sentry";
import { createServer } from "@/server"; import { createServer } from "@/server";
import { appFactory } from "~/app"; import { appFactory } from "~/app";
import { config } from "~/packages/config-manager/index"; import { config } from "~/packages/config-manager/index";
await configureLoggers();
if (cluster.isPrimary) { if (cluster.isPrimary) {
for (let i = 0; i < Number(process.env.NUM_CPUS ?? 1); i++) { for (let i = 0; i < Number(process.env.NUM_CPUS ?? 1); i++) {
cluster.fork(); cluster.fork();