Skip to content

Prevent the default logger from flooding console in cargo test #105

@SpriteOvO

Description

@SpriteOvO

Discussed in #104

Originally posted by @JensMertelmeyer October 24, 2025
We use spdlog heavily throughout our application. However, running cargo test will flood the console with logs because in several hundred tests, we were too lazy to set up a separate mock logging instance and it will all go to spdlog's default stdout/stderr logger.

I have not been able to find a way around it. While spdlog's creation of a default logger (if none has been set up yet) is a beautiful feature, it's not quite what we need within our tests.

Would it be possible to put this behind a feature flag? Or is there some other way of controlling (possibly from Cargo.toml what the default logger should be (like chosing between a "null" logger or regular stdout/stderr)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions