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

关于模块过滤器 #32

Open
t1000ln opened this issue Apr 17, 2024 · 0 comments
Open

关于模块过滤器 #32

t1000ln opened this issue Apr 17, 2024 · 0 comments

Comments

@t1000ln
Copy link

t1000ln commented Apr 17, 2024

你好!
在我的应用中使用了fast_log 1.6.16作为日志输出,用法非常接近以前在java中习惯用的log4j,体验很棒,但最近有两个小问题反馈一下。

  1. 通过ModuleFilter过滤tracing包的日志,在linux环境下的表现与windows不同。在windows下,被过滤了就不会输出任何级别的日志,而在linux下似乎没起作用。在linux下,被过滤时还会受LevelFilter的影响,只要低于设定级别就会输出日志。
    下面是配置代码:
let filter = ModuleFilter::new();
filter.modules.push("tracing::span".to_string());

fast_log::init(fast_log::Config::new()
        .console()
        .chan_len(Some(100000))
        .level(LevelFilter::Debug)
        .add_filter(filter)
        .file_split(&log_path, LogSize::MB(5), RollingType::All, LogPacker {})
    ).unwrap();

linux下运行时仍然会输出日志信息:

2024-04-17 17:50:08.078557605 [INFO] socket reader;
  1. 第二个问题,通过ModuleFilter过滤很好,但是应用依赖了很多层,层,层的第三方的包,运行时突然蹦出来的日志信息都不知道是哪里来的,找起来一点头绪都没有,很是头大。我只好在调试时换个日志框架simple_logger先找出捣乱的包名,记下来,再切换回fast_log加入过滤器。有没有更直接的方法,可以直接看到是哪个包输出了日志?
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

No branches or pull requests

1 participant