Skip to content

Commit

Permalink
debug should not be the default log level.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Kao committed Jan 3, 2024
1 parent a7d9fac commit 2c7b027
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ const handle = app.getRequestHandler();

const logMiddleware = (req: Request, res: Response, next: NextFunction) => {
// Log information about the incoming request
console.log(`Request Method: ${req.method}`);
console.log(`Request URL: ${req.url}`);
console.log(`Request Headers: ${JSON.stringify(req.headers)}`);
console.log(`Request Body: ${JSON.stringify(req.body)}`);

// Continue processing the request
logger.debug(`Request Method: ${req.method}`);
logger.debug(`Request URL: ${req.url}`);
logger.debug(`Request Headers: ${JSON.stringify(req.headers)}`);
logger.debug(`Request Body: ${JSON.stringify(req.body)}`);
next();
};

Expand Down
2 changes: 1 addition & 1 deletion server/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const hformat = winston.format.printf(
);

const logger = winston.createLogger({
level: process.env.LOG_LEVEL?.toLowerCase() || 'debug',
level: process.env.LOG_LEVEL?.toLowerCase() || 'info',
format: winston.format.combine(
winston.format.splat(),
winston.format.timestamp(),
Expand Down

0 comments on commit 2c7b027

Please sign in to comment.