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

Add Zerolog-based logger and update dependencies #1477

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

yunkon-kim
Copy link
Member

@yunkon-kim yunkon-kim commented Mar 29, 2024

This PR includes the following:

  • Add Zerolog-based logger and middleware
  • Add environment variables for the new logger to setup.env and Dockerfile
  • Replace the logger provided by Echo with a Zerolog-based custom logger

Overview

Zerolog is a fast and simple logger dedicated to JSON output 👍 (see Zero Allocation JSON Logger)

With this cool Zerolog, I'd like to add a new logger and middleware for Echo.

The new logger and middleware will provide:

  • multiple log output to stdout (ConsoleWriter), log file, and both,
  • writing logs to rolling file by lumberjack,
    • test completed! concurrent logging to files
  • pretty logging on console about each HTTP request.

Lastly, I aim to increase productivity through highly readable logs.

(HTTP request sample - I can access the problematic code easily. (IDE: VSCode)
image

* Add Zerolog-based logger and middleware
* Add environment variables for the new logger to `setup.env` and Dockerfile
* Replace the logger provided by Echo with Zerolog-based custom logger
Copy link
Member

@seokho-son seokho-son left a comment

Choose a reason for hiding this comment

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

LGTM!! :)

마이너한 질문이 있습니다.
zerolog.log 라는 명칭이 지정되어 있는데, 해당 파일의 네이밍이 적절한지 문의드립니다. log 파일은 log 파일을 생성하는 도구나 방법을 명칭으로 하기보다는 어떤 종류의 로그인지 의미를 파악할 수 있는 네이밍이 더 좋지 않을까 하고 생각해보았습니다. :)

@yunkon-kim
Copy link
Member Author

@seokho-son 좋은 의견 감사드립니다! (해당 부분은 log_conf.yaml에 기재된 로그 파일 이름과 겹치지 않는 선에서 적용해본 로그 파일 이름 이었습니다.)

이 PR이 적용되면, HTTP request 및 앞으로 코드 상에 log.Debug().Msg()...과 같이 추가/대체될 부분에 대해 로깅하게 될 것 입니다. 이는 tumblebug 에 대한 logging 이라고 볼 수 있을 것 같고요.

tumblebug.log로 변경하면 어떨까 합니다. 괜찮을지 확인 부탁드립니다.

@seokho-son
Copy link
Member

@yunkon-kim 감사합니다. 현재는 단순히 시스템 로그이므로, tumblebug.log 도 좋을 것 같고, 향후에 로그의 종류를 구분하게 되면 tb-xx.log , tb-yy.log 이런식으로 변경할 수도 있을 것 같습니다. :)

명칭 변경해주시면 바로 승인하겠습니다. :)

@yunkon-kim
Copy link
Member Author

@seokho-son 수정하였습니다!

@seokho-son
Copy link
Member

감사합니다!

@seokho-son seokho-son merged commit a8184e7 into cloud-barista:main Apr 1, 2024
3 checks passed
@yunkon-kim yunkon-kim deleted the yunkon-kim-240329-1 branch April 2, 2024 12:00
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.

None yet

2 participants