2个版本

0.1.1 2022年4月30日
0.1.0 2022年4月30日

#589 in 调试

MIT许可证

5KB

log4r

一个用于Rust的极其简单的日志包。

log4r相对于log的主要优势是使用函数而不是宏。这样您可以在clippy.toml中禁止它们,使其更适合调试。

如何使用

  1. 首先将crate添加到Cargo.toml,在依赖项下添加log4r = 0.1.0
  2. use log4r::*;添加到文件的顶部。
  3. 现在您可以这样做: info(some_info.to_string())

如果只想在开发期间使用这些函数,请将以下内容添加到项目根目录下的clippy.toml

disallowed-methods = [
    { path = "log4r::success", reason = "Logs are not allowed in builds" },
    { path = "log4r::warning", reason = "Logs are not allowed in builds" },
    { path = "log4r::info", reason = "Logs are not allowed in builds" },
    { path = "log4r::error", reason = "Logs are not allowed in builds" },
    { path = "log4r::critical", reason = "Logs are not allowed in builds" },
    { path = "log4r::log", reason = "Logs are not allowed in builds" },
]

当您运行Clippy时,它将报告关于这些函数使用错误/警告。

无运行时依赖