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

Global async logging #232

Merged
merged 6 commits into from
Feb 20, 2020
Merged

Global async logging #232

merged 6 commits into from
Feb 20, 2020

Conversation

ec2
Copy link
Member

@ec2 ec2 commented Feb 18, 2020

Summary of changes
Changes introduced in this pull request:

  • Replace slog with async-log + pretty_env_logger
  • No more need to pass around a logger. There is now a global logger.

Reference issue to close (if applicable)

Closes

Other information and links

@ec2 ec2 changed the title Ec2/logging Global async logging Feb 18, 2020
Copy link
Contributor

@austinabell austinabell left a comment

Choose a reason for hiding this comment

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

Sooooo much cleaner

.filter(None, log::LevelFilter::Trace)
.build();
async_log::Logger::wrap(logger, || 0)
.start(log::LevelFilter::Trace)
Copy link
Contributor

Choose a reason for hiding this comment

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

Info should probably be default?

Suggested change
.start(log::LevelFilter::Trace)
.start(log::LevelFilter::Info)

// SPDX-License-Identifier: Apache-2.0, MIT

pub(crate) fn setup_logger() {
let logger = pretty_env_logger::formatted_timed_builder()
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, thoughts on changing the timestamp format

2020-02-18T19:35:07.045

to something like

2020-02-18 19:35:07

Nit, but the timestamp is a lot to look at right now lol. Can change in another PR or something, this may just be me

@vmx
Copy link
Contributor

vmx commented Feb 19, 2020

I've good experience with https://crates.io/crates/flexi_logger.

There is also https://github.com/filecoin-project/rust-fil-logger which is used for the filecoin proofs stuff that has a flag to create JSON output that is compatible to the one Lotus is using.

Copy link
Contributor

@austinabell austinabell left a comment

Choose a reason for hiding this comment

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

fine to leave default logging level as trace for now if you want (although annoying to read through trace logs inside libp2p) and opened issue with: #237

@austinabell austinabell merged commit 56e6230 into master Feb 20, 2020
@austinabell austinabell deleted the ec2/logging branch February 20, 2020 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants