Skip to content

Commit

Permalink
Fix log level of stock logo requests
Browse files Browse the repository at this point in the history
Signed-off-by: Marvin A. Ruder <[email protected]>
  • Loading branch information
marvinruder committed Nov 11, 2023
1 parent a2f64fb commit c213c1b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/backend/src/utils/logger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from "node:fs";

import { baseURL, stockLogoEndpointSuffix } from "@rating-tracker/commons";
import { baseURL, stockLogoEndpointSuffix, stocksEndpointPath } from "@rating-tracker/commons";
import cron from "cron";
import { Request, Response } from "express";
import pino from "pino";
Expand Down Expand Up @@ -84,7 +84,12 @@ new cron.CronJob(
* @returns {void}
*/
export const logRequest = (req: Request, res: Response, time: number): void =>
logger[req.originalUrl.startsWith(`${baseURL}${stockLogoEndpointSuffix}`) || req.ip === "::1" ? "trace" : "info"](
logger[
(req.originalUrl.startsWith(baseURL + stocksEndpointPath) && req.originalUrl.startsWith(stockLogoEndpointSuffix)) ||
req.ip === "::1"
? "trace"
: "info"
](
{
prefix: "nodejs",
req: {
Expand Down

0 comments on commit c213c1b

Please sign in to comment.