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

加入 log level #272

Merged

Conversation

karta0807913
Copy link
Contributor

👏 解決掉的 issue / Resolved Issues

📝 相關的 issue / Related Issues

⛏ 變更內容 / Details of Changes

  • 使用命令行參數或是環境變數指派 log level
  • log 加入 terminal 顏色
  • 修改 route_token.go 不使用 logger 的錯誤

@PichuChen
Copy link
Member

加入色彩感覺很棒,不過他可以是可選的嗎?總覺得如果把色彩寫到在 /var/log 的紀錄檔裡面之後在用工具來分析會有點令人不安。

但是對於開發時直接用cli 執行來說應該是有幫助。

@appleboy
Copy link
Contributor

有沒有考慮用開源專案?像是 sirupsen/logrus 或 rs/zerolog 這些簡易的 Logger 模組?

@karta0807913
Copy link
Contributor Author

加入色彩感覺很棒,不過他可以是可選的嗎?總覺得如果把色彩寫到在 /var/log 的紀錄檔裡面之後在用工具來分析會有點令人不安。

但是對於開發時直接用cli 執行來說應該是有幫助。

這部分在做輸出的時候有判斷
如果輸出不是tty就會把顏色去掉

@karta0807913
Copy link
Contributor Author

有沒有考慮用開源專案?像是 sirupsen/logrus 或 rs/zerolog 這些簡易的 Logger 模組?

目前的想法是先銜接當前的程式碼,不要做太大改動。
需要加入其他 dependents 可能要先開 issue 討論,這可能會耗費比較久的時間。

@karta0807913 karta0807913 marked this pull request as ready for review August 28, 2021 01:15
@codecov-commenter
Copy link

codecov-commenter commented Aug 28, 2021

Codecov Report

Merging #272 (8ef19e0) into development (d66a810) will increase coverage by 0.74%.
The diff coverage is 68.29%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #272      +/-   ##
===============================================
+ Coverage        44.49%   45.23%   +0.74%     
===============================================
  Files               29       29              
  Lines             1661     1691      +30     
===============================================
+ Hits               739      765      +26     
- Misses             819      821       +2     
- Partials           103      105       +2     
Impacted Files Coverage Δ
internal/delivery/http/route_classes.go 40.47% <ø> (ø)
internal/repository/board.go 0.00% <0.00%> (ø)
internal/repository/repository.go 0.00% <ø> (ø)
main.go 0.00% <0.00%> (ø)
internal/repository/user.go 47.69% <50.00%> (+0.07%) ⬆️
internal/logging/logger.go 85.18% <85.18%> (+85.18%) ⬆️
internal/config/config.go 78.26% <100.00%> (+0.98%) ⬆️
internal/delivery/http/route_token.go 47.54% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d66a810...8ef19e0. Read the comment docs.

@karta0807913
Copy link
Contributor Author

@PichuChen 請問這個 PR 有什麼需要修改的地方嗎?

Copy link
Member

@PichuChen PichuChen left a comment

Choose a reason for hiding this comment

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

LGTM

@PichuChen PichuChen merged commit bc314b6 into Ptt-official-app:development Oct 3, 2021
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.

[建議] logger增加debug level的功能
4 participants