4 个版本
0.1.3 | 2023年1月28日 |
---|---|
0.1.2 | 2022年6月30日 |
0.1.1 | 2021年5月19日 |
0.1.0 | 2021年5月17日 |
#1116 in 开发工具
81 每月下载
21KB
137 代码行
Sentry 与 log4rs 的集成
此 crate 提供了将 sentry 与 log4rs 集成的支持。
快速入门
log4rs.yaml
refresh_rate: 30 seconds
appenders:
stdout:
kind: console
sentry_demo:
kind: sentry
encoder:
pattern: "{m}"
dsn: "https://[email protected]/42" # Your Sentry DSN here
threshold: error
root:
level: info
appenders:
- stdout
- sentry_demo
main.rs
use log::{error, info};
use log4rs;
use sentry_log4rs::SentryAppender;
fn main() {
log4rs::init_file("log4rs.yaml", SentryAppender::deserializers()).unwrap();
info!("booting up");
error!("[yaml-config] Something went wrong!");
// ...
}
测试
可以使用 examples/yaml_config.rs
和 example/code_config.rs
示例进行功能测试,只需更新 dsn
值并运行即可
cargo run --example code_config
cargo run --example yaml_config
许可证
- Apache 许可证 2.0 版 (LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0)
- MIT 许可证 (LICENSE-MIT 或 http://opensource.org/licenses/MIT)
依赖项
~6MB
~145K SLoC