-
Notifications
You must be signed in to change notification settings - Fork 1
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
서버 로깅 구현 #349
서버 로깅 구현 #349
Conversation
🔥🔥🔥 Backend CI Failed. github action link 🔥🔥🔥 |
🔥🔥🔥 Backend CI Failed. github action link 🔥🔥🔥 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굿굿
interface ServerLogPayload { | ||
val type: ServerLogType | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ServerLogType이 이미 ServerLog에 있는데 굳이 여기도 들어갈 필요가 있으려나요?
여기도 넣으실 거면 ServerLog class의 init에 type == payload.type을 check 하면 좋겠습니당
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사실상 type 별로 payload 가 생길거라고 생각했고 그래서 payload 만 알면 type 을 바로 알 수 있도록 interface 의 val 로 넣었습니다. ServerLog (ServerEvent) 의 필드로 넣은 것은 db 에 인덱스 걸고 저장하고 싶어서였는데, db 스키마와 애플리케이션 모델이 꼭 같은 필요는 없으니 다른 더 좋은 표현 방법이 있나 고민해보겠습니다
없으면 그냥 init 블록 둘 것 같네요 ㅎㅎ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지금도 중복 저장되고 있겠군요.. 음
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4291255
db 에 중복저장 안되도록 함수로 빼고 init 블럭 안에 체크로직 넣었습니다
가독성을 위해서 type 은 text 로 함께 묶어서 들어가지 않고 따로 칼럼으로 두는게 좋을 것 같아서요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어차피 constructor 에 없는 필드라 저장은 안되겠네요
따로 converter 에서 paylod 와 타입을 매핑해주는 것보다 type 이 payload 에 종속적인게 관리하기 좋을 것 같아서 이렇게 두고,
만에 하나 runtime 에 에러가 날 수 있는 여지가 있기 때문에 try catch 로 감쌌습니다
6a9b16c
|
||
import java.time.Instant | ||
|
||
data class ServerLog( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 domain event랑 약간 겹치더라도 log 보다는 event라는 이름이 더 좋을 것 같은데요, log랑 event라는 워딩에서 느껴지는 차이가 꽤 분명한 것 같기 때문입니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0857cc9
log -> event 로 이름 변경했습니다
🔥🔥🔥 Backend CI Failed. github action link 🔥🔥🔥 |
server_log
라는 엔티티를 만들어서 풀어봤습니다Checklist