4 releases

0.1.3 Jan 28, 2023
0.1.2 Jun 30, 2022
0.1.1 May 19, 2021
0.1.0 May 17, 2021

#1498 in Development tools

Download history 12/week @ 2024-11-16 12/week @ 2024-11-23 30/week @ 2024-11-30 25/week @ 2024-12-07 27/week @ 2024-12-14 8/week @ 2024-12-21 7/week @ 2024-12-28 51/week @ 2025-01-25 40/week @ 2025-02-01 15/week @ 2025-02-08 34/week @ 2025-02-15 16/week @ 2025-02-22 63/week @ 2025-03-01

129 downloads per month

MIT/Apache

21KB
137 lines

log4s integration for Sentry

Crates.io version Documentation

This crate provides support for integrating sentry with log4rs.

Quick Start

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!");
	// ...
}

Testing

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

License

Dependencies

~4.5–6.5MB
~116K SLoC