Skip to content

Commit

Permalink
feat: log display request method
Browse files Browse the repository at this point in the history
  • Loading branch information
condorheroblog committed Nov 10, 2023
1 parent de7dd6b commit df5f476
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export async function createFakeMiddleware(
}

if (logger) {
loggerOutput.info(colors.green(`request invoke ` + colors.cyan(req.url)), {
loggerOutput.info(colors.green(`request invoke ` + colors.cyan(req.method + " " + req.url)), {
timestamp: true,
clear: true,
});
Expand Down
3 changes: 2 additions & 1 deletion packages/vite-plugin-fake-server/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ export const vitePluginFakeServer = async (options: VitePluginFakeServerOptions
}
}
if (${JSON.stringify(opts.logger)}){
console.log("%c request invoke", "color: blue", req.url);
const requestMethod = req.method ? req.method.toUpperCase() : "GET";
console.log("%c request invoke" + " %c" + requestMethod + " " + req.url, "color: green", "color: blue");
}
} else {
// next external URL
Expand Down

0 comments on commit df5f476

Please sign in to comment.