Crates.io | sentry-log4rs |
lib.rs | sentry-log4rs |
version | 0.1.3 |
source | src |
created_at | 2021-05-17 03:12:02.993151 |
updated_at | 2023-01-28 02:18:45.856058 |
description | log4s integration for Sentry. |
homepage | https://github.com/wangfu91/sentry-log4rs |
repository | https://github.com/wangfu91/sentry-log4rs |
max_upload_size | |
id | 398439 |
size | 67,920 |
This crate provides support for integrating sentry with log4rs.
log4rs.yaml:
refresh_rate: 30 seconds
appenders:
stdout:
kind: console
sentry_demo:
kind: sentry
encoder:
pattern: "{m}"
dsn: "https://key@sentry.io/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!");
// ...
}
The functionality can be tested with examples/yaml_config.rs
and example/code_config.rs
examples, just update the dsn
value and run it with:
cargo run --example code_config
cargo run --example yaml_config