Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings and run cargo fmt #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions examples/proper.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
extern crate slog_stdlog;
extern crate slog_async;
extern crate slog_envlogger;
extern crate slog_term;
extern crate slog_scope;
extern crate slog_async;
extern crate slog_stdlog;
extern crate slog_term;

/// Import longer-name versions of macros only to not collide with legacy `log`
#[macro_use(slog_error, slog_info, slog_trace, slog_log, slog_o, slog_record,
slog_record_static, slog_b, slog_kv)]
#[macro_use(slog_error, slog_info, slog_trace, slog_o)]
extern crate slog;

use slog::Drain;
Expand All @@ -15,22 +14,20 @@ use slog::Drain;
extern crate log;

fn main() {
let drain =
slog_async::Async::default(
slog_envlogger::new(
slog_term::CompactFormat::new(
slog_term::TermDecorator::new()
.stderr().build()
).build().fuse()
));
let drain = slog_async::Async::default(slog_envlogger::new(
slog_term::CompactFormat::new(slog_term::TermDecorator::new().stderr().build())
.build()
.fuse(),
));

let root_logger = slog::Logger::root(drain.fuse(),
slog_o!("build" => "8jdkj2df", "version" => "0.1.5"));
let root_logger = slog::Logger::root(
drain.fuse(),
slog_o!("build" => "8jdkj2df", "version" => "0.1.5"),
);

slog_stdlog::init().unwrap();

slog_scope::scope(&root_logger, || {

slog_error!(root_logger, "slog error");
error!("log error");
slog_info!(root_logger, "slog info");
Expand Down
8 changes: 4 additions & 4 deletions examples/scopes.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
extern crate slog_stdlog;
extern crate slog_envlogger;
extern crate slog_scope;
extern crate slog_stdlog;

#[macro_use(o, kv)]
#[macro_use(o)]
extern crate slog;

#[macro_use]
Expand All @@ -15,7 +15,7 @@ fn main() {

slog_scope::scope(
&slog_scope::logger().new(o!("scope-extra-data" => "data")),
|| foo()
foo,
);

trace!("log trace");
Expand All @@ -27,7 +27,7 @@ fn foo() {
// scopes can be nested!
slog_scope::scope(
&slog_scope::logger().new(o!("even-more-scope-extra-data" => "data2")),
|| bar()
bar,
);
}

Expand Down
2 changes: 1 addition & 1 deletion examples/simple.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extern crate slog_stdlog;
extern crate slog_envlogger;
extern crate slog_stdlog;

#[macro_use]
extern crate log;
Expand Down
Loading