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

日志组件相关优化 #112

Merged
merged 8 commits into from
Sep 9, 2024

Conversation

linganmin
Copy link
Contributor

Changes:

  1. 修改日志interface增加WithContext方法,通过ctx串联请求链路信息方便实际业务通过traceid排查问题
  2. 日志结构增加trace、caller字段,优化日志格式
  3. 增加stdout配置项,当该配置为true时日志将以stdout方式在终端输出

Log Example:

{"level":"info","timestamp":"2024-09-09T16:18:12+08:00","caller":"kernel/accessToken.go:370","content":"------------------response content:HTTP/1.1 200 OK\r\nContent-Length: 129\r\nConnection: keep-alive\r\nContent-Type: application/json; encoding=utf-8\r\nDate: Mon, 09 Sep 2024 08:18:12 GMT\r\nLogicret: 40164\r\nRetkey: 11\r\n\r\n{"errcode":40164,"errmsg":"invalid ip 114.218.1.162 ipv6 ::ffff:114.218.1.162, not in whitelist rid: 66deaf44-47fd8d1d-213c2752"}","trace":"1f6161ada79fa84c0955ad9f3b9234d9","span":"660845ac3e69d02c"}

@Matrix-X
Copy link
Contributor

Matrix-X commented Sep 9, 2024

您好,感谢你的PR,能否通过微信或者腾讯会议沟通一下,我看好像rotate这块,被改了,之前有一个依赖库lumberjack,用来分段保存日志。这个得一看一下

@linganmin
Copy link
Contributor Author

您好,感谢你的PR,能否通过微信或者腾讯会议沟通一下,我看好像rotate这块,被改了,之前有一个依赖库lumberjack,用来分段保存日志。这个得一看一下

你好,这块没有改哦,文件写日志还是用的lumberjack,应该是你之前把lumberjack封装到lib里了,对应的依赖没有执行go mod tidy 。我改动是把他拿到函数里了

image
image
image

@Matrix-X Matrix-X changed the base branch from develop to feature/logger September 9, 2024 09:11
@Matrix-X Matrix-X merged commit dbd654e into ArtisanCloud:feature/logger Sep 9, 2024
@Matrix-X
Copy link
Contributor

Matrix-X commented Sep 9, 2024

好的,我测试一下,应该没啥问题

@Matrix-X
Copy link
Contributor

Matrix-X commented Sep 9, 2024

thx for your pr, pls review v3.2.6

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.

2 participants