#log #sentry #log4rs

log4rs-sentry

Sentry Appender for log4rs

2 stable releases

✓ Uses Rust 2018 edition

1.0.1 May 12, 2019

#78 in #log

Apache-2.0 Custom license

6KB
63 lines

log4rs-sentry

Sentry Appender for log4rs

Usage

Add the following to your Cargo.toml:

log4rs-sentry = "^1.0"

Now, when configuring your log4rs logger, use the following code:

use log4rs_sentry::SentryAppender;

let sentry_encoder = PatternEncoder::new("{m}");
let sentry = SentryAppender::new(Box::new(sentry_encoder));

let config = Config::builder()
		.appender(Appender::builder().build("sentry", Box::new(sentry)))
		// other appenders
		.build(Root::builder()
				.appender("sentry")
				// other appenders
				.build(LevelFilter::Warn))
		.unwrap();

Dependencies

~7.5MB
~159K SLoC