Skip to content

Cargo should use standard logging framework #6751

@sanmai-NL

Description

@sanmai-NL

Cargo can be invoked with a command line interface, as well as non-interactively.

In the latter case, Cargo may e.g. be used as part of a Continuous Integration pipeline.
For that use case, it is important to reduce noise in the build output. Moreover, it is important to see regular timestamps in order to determine where most time is spent in the pipeline.

Cargo writes a line for every dependency package that is builds, which means a lot of information is output that can be considered noise, in this use case. Currently, Cargo can only be made completely silent using the --quiet argument. However, this does not even report errors. This makes this option unattractive to this use case. Cargo also doesn't include timestamps in its output.

Similar to most other long-running command line utilities, Cargo should only use a standard logging framework, configurable by the caller. This would make it easy to:

  • Allow the caller to filter what to log.
  • Include accurate timestamps and other details in log entries.

This change should not be complex in terms of design. In case a concern about aesthetics overrides the previous concerns, and suppose it could not be addressed within the proposed solution, then the solution can be limited to a non-interactive context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-console-outputArea: Terminal output, colors, progress bar, etc.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions