Skip to content

log4rs integration for Sentry

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

wangfu91/sentry-log4rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

About

log4rs integration for Sentry

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages