Skip to content

Commit

Permalink
chore: remove spammy logs
Browse files Browse the repository at this point in the history
  • Loading branch information
rdubigny committed Sep 23, 2024
1 parent be6e3fd commit abb58ce
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,12 @@ if (!DISABLE_SECURITY_RESPONSE_HEADERS) {
// Note that express.static always sends weak ETags.
app.set("etag", false);

let morganOption = {};

let morganOption: morgan.Options<Request, Response> = {
skip: (req: Request, _res: Response) => req.baseUrl.startsWith("/dist"),
};
if (ACCESS_LOG_PATH) {
morganOption = {
stream: fs.createWriteStream(ACCESS_LOG_PATH, { flags: "a" }),
};
morganOption.stream = fs.createWriteStream(ACCESS_LOG_PATH, { flags: "a" });
}

const httpLogger = morgan("combined", morganOption);
app.use(httpLogger);

Expand Down

0 comments on commit abb58ce

Please sign in to comment.