Skip to content

Commit

Permalink
Using the configured logger for debugging uploads.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTail committed Mar 16, 2024
1 parent 12c0775 commit ce24660
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions example/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const config = createConfig({
server: {
listen: 8090,
upload: {
debug: true,
limits: { fileSize: 51200 },
limitError: createHttpError(413, "The file is too large"), // affects uploadAvatarEndpoint
},
Expand Down
4 changes: 4 additions & 0 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ export const createServer = async (config: ServerConfig, routing: Routing) => {
...derivedConfig,
abortOnLimit: false,
parseNested: true,
// @todo remove ignore when the types updated:
// @see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/69016
// @ts-ignore
logger: { log: rootLogger.debug.bind(rootLogger) },
}),
);
if (limitError) {
Expand Down
1 change: 1 addition & 0 deletions tests/unit/server.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ describe("Server", () => {
abortOnLimit: false,
parseNested: true,
limits: { fileSize: 1024 },
logger: { log: expect.any(Function) },
});
});

Expand Down

0 comments on commit ce24660

Please sign in to comment.