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 : pino child 추가 #224

Merged
merged 2 commits into from
Aug 8, 2024
Merged

feat : pino child 추가 #224

merged 2 commits into from
Aug 8, 2024

Conversation

kimhr3001
Copy link

@kimhr3001 kimhr3001 commented Aug 7, 2024

PR 의 종류는 어떤 것인가요?

  • 버그 수정
  • 새로운 기능
  • 리팩토링
  • 문서 수정
  • 워크플로우 수정

무엇을 어떻게 변경했나요?

log 가독성을 높이기 위해 pino.child 추가

코드 변경을 이해하기 위한 배경지식이 필요하다면 설명 해주세요.

https://github.com/pinojs/pino

디펜던시 변경이 있나요?

없음

어떻게 테스트 하셨나요?

스모크, 스웨거

코드의 실행결과를 볼 수 있는 로그나 이미지가 있다면 첨부해주세요.

image image

@kimhr3001 kimhr3001 requested review from soomtong, plainOldCode and a team August 7, 2024 01:57
@kimhr3001 kimhr3001 self-assigned this Aug 7, 2024
@soomtong soomtong requested review from 9w and TaehuiKim and removed request for soomtong August 7, 2024 01:58
@soomtong
Copy link
Contributor

soomtong commented Aug 7, 2024

child 로거를 통해서 추가로그를 봐야하는게 어떤 이점이 있어요?

뭔가 정형화된 audit 로그를 구성하려는 거면 다른 패키지나 다른 구성으로 준비하는게 어떨까 싶어요.

@kimhr3001
Copy link
Author

kimhr3001 commented Aug 7, 2024

child 로거를 통해서 추가로그를 봐야하는게 어떤 이점이 있어요?

뭔가 정형화된 audit 로그를 구성하려는 거면 다른 패키지나 다른 구성으로 준비하는게 어떨까 싶어요.

기존에는 obj 데이터를 로깅하려 할때 msg에 문자열 형태로 변환하여 보여지고 있어
클라우드 로그에서 특정 데이터로 검색하기가 용이 하지 않았는데요.
obj 를 key:value 형태로 변경하면
클라우드 로그에서 해당 value 를 대상으로 질의가 쉬워 집니다.

예를 들면
image

@soomtong
Copy link
Contributor

soomtong commented Aug 7, 2024

아하, 매우 유용하겠네요!

@kimhr3001 kimhr3001 requested a review from elegantcoder August 7, 2024 03:05
@9w 9w requested a review from a team August 7, 2024 03:15
@@ -8,4 +9,5 @@ export interface Logger {
warn(msgTemplate?: string, ...args: unknown[]): void;
error(msgTemplate?: string, ...args: unknown[]): void;
log(msgTemplate?: string, ...args: unknown[]): void;
child(options: Record<string, unknown>): pino.Logger;
Copy link
Contributor

@moonimooni moonimooni Aug 7, 2024

Choose a reason for hiding this comment

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

피노 디펜던시는 구현체에만 존재하고 페블즈 인터페이스는 독립적으로 존재하는 게 본래 의도에 맞습니다.
급한 건이라면 추후 개선해도 괜찮겠지만 아니라면 수정되었으면 해요.
구현체에서 constructor 오버로딩을 통해 child 메소드에서 Logger 타입을 리턴할 수 있을 거 같아 보여요.
테스트도 붙여주시면 좋습니다. (부모 로거와 차일드 로거의 객체가 구분되는가 같은거..)

Copy link
Author

@kimhr3001 kimhr3001 Aug 7, 2024

Choose a reason for hiding this comment

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

overloading 해서 사용자가 체이닝 해서 사용하는 방법과
기존 사용성을 유지하는 flat 을 추가 하였습니다.
의견 부탁드려요 🙏

Copy link
Contributor

@TaehuiKim TaehuiKim left a comment

Choose a reason for hiding this comment

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

유용하게 사용할 수 있을 듯 하네요

Copy link
Contributor

@yunj8649 yunj8649 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@moonimooni moonimooni left a comment

Choose a reason for hiding this comment

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

LGTM

@kimhr3001 kimhr3001 merged commit 6c289c0 into main Aug 8, 2024
1 check passed
@kimhr3001 kimhr3001 deleted the logger/add-pino-child branch August 8, 2024 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants