Skip to content

Logger.put_module_level does not silence preloads #602

@SteffenDE

Description

@SteffenDE

Elixir version

1.17.0-dev

Database and Version

PostgreSQL 14

Ecto Versions

Ecto 3.11

Database Adapter and Versions (postgrex, myxql, etc)

postgrex 0.17.5

Current behavior

I have a job that runs some queries that I'd like to exclude from logging in development. I'm using Logger.put_module_level, which works just fine, except for queries caused by preloads. I also tried setting Logger.put_process_level, but that also only works for the initial queries and not the preloads.

Expected behavior

As the logged information from the stacktrace includes the originating module, it would be nice if it used this information to lookup a level using Logger.get_module_level or maybe even Logger.get_process_level using the callers?

Maybe there are some other ideas on how to achieve this.

I'd be happy to work on a PR for this with some feedback on what the correct approach could be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions