mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
fix(federation): 🐛 Fix debug logger not correctly outputting
This commit is contained in:
parent
eab61b38f1
commit
fd38161769
3 changed files with 15 additions and 3 deletions
|
|
@ -24,7 +24,7 @@ import { fromZodError } from "zod-validation-error";
|
|||
import type { Application } from "~database/entities/Application";
|
||||
import { getFromHeader } from "~database/entities/User";
|
||||
import type { User } from "~packages/database-interface/user";
|
||||
import { LogLevel } from "~packages/log-manager";
|
||||
import { LogLevel, LogManager } from "~packages/log-manager";
|
||||
import type { APIRouteMetadata, HttpVerb } from "~types/api";
|
||||
|
||||
export const applyConfig = (routeMeta: APIRouteMetadata) => {
|
||||
|
|
@ -302,7 +302,10 @@ export const jsonOrForm = () => {
|
|||
});
|
||||
};
|
||||
|
||||
export const debugRequest = async (req: Request, logger = consoleLogger) => {
|
||||
export const debugRequest = async (
|
||||
req: Request,
|
||||
logger = new LogManager(Bun.stdout),
|
||||
) => {
|
||||
const body = await req.clone().text();
|
||||
await logger.log(
|
||||
LogLevel.DEBUG,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ const isEntry = true;
|
|||
export const logger = new LogManager(
|
||||
isEntry ? requests_log : Bun.file("/dev/null"),
|
||||
);
|
||||
|
||||
export const consoleLogger = new LogManager(
|
||||
isEntry ? Bun.stdout : Bun.file("/dev/null"),
|
||||
!noColors,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue