Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] logger 적용 #333

Merged
merged 14 commits into from
Dec 2, 2024
Merged

[Feat] logger 적용 #333

merged 14 commits into from
Dec 2, 2024

Conversation

Fixtar
Copy link
Collaborator

@Fixtar Fixtar commented Dec 1, 2024

관련 이슈 번호

작업 내용

  • winston logger 추가
  • batch를 이용한 S3에 Log파일 업로드

PR 포인트

고민과 학습내용

winston logger를 추가하였습니다. 모든 api 요청에 대해 log를 남기도록 했습니다.
logger를 모듈로 분리하여 각각의 모듈에서 import 하여 사용할 수 있습니다.

winston을 매일 1개의 .log 파일을 생성하도록 설정하였습니다.
따라서 이 Log파일을 batch를 이용하여 매일 1번씩 Object Storage로 업로드 하도록 구현하였습니다.

스크린샷

스크린샷 2024-12-02 오전 2 04 58

@Fixtar Fixtar added BE Backend 관련 작업 ✨ Feature 새로운 기능 추가 labels Dec 1, 2024
@Fixtar Fixtar added this to the 통합 개발 환경 구축 milestone Dec 1, 2024
@Fixtar Fixtar self-assigned this Dec 1, 2024
Comment on lines 23 to 28

console.log('today : ', today);
const logFileName = `application-${today.toISOString().split('T')[0]}.log`;
const localFilePath = path.join(logsDir, logFileName);

console.log('localFilePath : ', localFilePath);
Copy link
Collaborator

Choose a reason for hiding this comment

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

p3 : 필요없는 log나 주석은 삭제해주셔도 좋을 것 같아요~!

Copy link
Collaborator

Choose a reason for hiding this comment

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

p1:
서버측에 로그 생성시 생성되었다는 것을 알리기 위해 console.log를 사용하신 걸까요??

현재 lint 상에 console.log는 오류가 발생하도록 되어있어 CI/CD시 오류가 발생할 것으로 보입니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

헉 테스트하고 그대로 뒀습니다 삭제하겠습니다~!


try {
const uploadResponse = await this.s3.send(new PutObjectCommand(params));
// console.log('File uploaded:', uploadResponse);
Copy link
Collaborator

Choose a reason for hiding this comment

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

여기도용

Copy link
Collaborator

@begong313 begong313 left a comment

Choose a reason for hiding this comment

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

이따가 로거 어떻게적용되는지, 어디에 추가로 적용하면좋을지 얘기해보면좋을거같ㅇ습니다!

import { ConfigModule } from '@nestjs/config';
import { ScheduleModule } from '@nestjs/schedule';
Copy link
Collaborator

Choose a reason for hiding this comment

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

p3 사용하지않는 IMPORT 제거부탁드립니다!

Comment on lines 23 to 28

console.log('today : ', today);
const logFileName = `application-${today.toISOString().split('T')[0]}.log`;
const localFilePath = path.join(logsDir, logFileName);

console.log('localFilePath : ', localFilePath);
Copy link
Collaborator

Choose a reason for hiding this comment

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

p1:
서버측에 로그 생성시 생성되었다는 것을 알리기 위해 console.log를 사용하신 걸까요??

현재 lint 상에 console.log는 오류가 발생하도록 되어있어 CI/CD시 오류가 발생할 것으로 보입니다

@github-actions github-actions bot added size/l and removed size/xl labels Dec 2, 2024
@Fixtar Fixtar merged commit cbf91fd into develop Dec 2, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE Backend 관련 작업 ✨ Feature 새로운 기능 추가 size/l
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] Winston 로그 설정
5 participants