Skip to content

Conversation

@sickbirdd
Copy link
Collaborator

진행 내용

api 서버에 들어오는 요청들에 대해 로그를 남길 수 있는 logger 미들웨어를 추가하였습니다.
기존의 exception filter에 작성한 log 코드는 그대로 보존합니다. request가 들어왔을 때 info level에서 다음과 같이 로그를 남깁니다.

const { ip, method, originalUrl } = request;
const userAgent = request.get('user-agent');
request.on('close', () => {
    this.logger.info(`${method} ${originalUrl} - ${userAgent} ${ip}`);
});

@sickbirdd sickbirdd added feature 새로운 기능 backend 백엔드 관련 labels Nov 27, 2023
@sickbirdd sickbirdd added this to the 4주차 milestone Nov 27, 2023
@sickbirdd sickbirdd self-assigned this Nov 27, 2023
Copy link
Collaborator

@Muungi Muungi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

로그 내용으로 서버 버그를 고쳐봅시다...!

@sickbirdd sickbirdd merged commit ddbbe7a into dev/be Nov 27, 2023
@sickbirdd sickbirdd deleted the feat/be/logger-middleware branch December 14, 2023 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend 백엔드 관련 feature 새로운 기능

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

3 participants