← 输入框|github.com|刷新
Skip to content

Add a structured logger and use it in all mock components - #29

Merged
Jannis merged 3 commits into
masterfrom
jannis/structured-logging
May 9, 2018
Merged

Jannis merged 3 commits into
masterfrom
jannis/structured-logging

Conversation

@Jannis

@Jannis Jannis commented May 7, 2018

Copy link
Copy Markdown
Contributor

This resolves #28 by adding a structured logger based on slog.

This PR depends on #20 being merged first.

@Jannis Jannis added the enhancement New feature or request label May 7, 2018
@Jannis Jannis added this to the Free Service milestone May 7, 2018
@Jannis Jannis self-assigned this May 7, 2018
@Jannis
Jannis requested a review from a team May 7, 2018 11:38
@Jannis Jannis changed the title Add a structured logger and use it in all mock componnts Add a structured logger and use it in all mock components May 7, 2018
let decorator = slog_term::TermDecorator::new().build();
let drain = slog_term::CompactFormat::new(decorator).build().fuse();
let drain = slog_async::Async::new(drain).build().fuse();
slog::Logger::root(drain, o!())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the o! macro do?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a slog macro for defining key/value pairs: https://docs.rs/slog/2.2.3/slog/macro.o.html

@Zerim Zerim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@Jannis
Jannis force-pushed the jannis/structured-logging branch from f16ff97 to a0a55b7 Compare May 9, 2018 10:16
@Jannis
Jannis merged commit c5c607f into master May 9, 2018
@Jannis
Jannis deleted the jannis/structured-logging branch May 9, 2018 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set up structured logging

2 participants