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

✨ Proposal: Support New and SetCallerSkip func for hlog #222

Closed
a631807682 opened this issue Aug 31, 2022 · 1 comment
Closed

✨ Proposal: Support New and SetCallerSkip func for hlog #222

a631807682 opened this issue Aug 31, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@a631807682
Copy link
Member

Is your feature request related to a problem? Please describe.

en

At present, it is difficult for us to directly use hlog in business scenarios.
First of all it is a public instance, any settings will take effect globally (not only business code, but also hertz).
Secondly as the documentation says hlog it is difficult to encapsulate. This caused me to reimplement FullLogger even if I only needed a simple wrapper.

zh

目前我们很难在业务场景中直接使用hlog
首先它是一个公共的实例,任何设置都将导致全局生效,(不仅在业务日志中生效,也包含hertz源码日志也生效)。
其次正如文档说的那样封装hlog可能会导致日志内容里文件名和行数不准确。这导致了即便我只需要简单封装,我也要重新实现FullLogger

Describe the solution you'd like

en

Add a New func to create a different defaultLogger instance, add a SetCallerSkip func to specify the caller depth.

zh

增加一个New方法去创建不同的defaultLogger实例,增加SetCallerSkip方法去指定调用位置。

@welkeyever
Copy link
Member

目前的这套日志确实有一定的局限性,这块如果有好的优化思路欢迎直接提出来一起看看哈;

目前的一些想法:

  1. 给hertz实例增加一个local logger(避免受全局配置的影响)
  2. 增加配置call depth的方式

@li-jin-gou 一起看看哈,最好是能出一个优化方案

@li-jin-gou li-jin-gou self-assigned this Sep 1, 2022
@li-jin-gou li-jin-gou added the enhancement New feature or request label Sep 1, 2022
@li-jin-gou li-jin-gou changed the title Proposal: Support New and SetCallerSkip func for hlog ✨ Proposal: Support New and SetCallerSkip func for hlog Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

3 participants