We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Modifying Logger Settings for Specific Elixir Tests
24
clicks

Source: jasontokoph.com
The author encountered difficulties in testing an Elixir code path that required specific info logs for auditing due to the log level being set to :warning and above in their test environment. To resolve this, they created a macro named log_level that allows temporary changes to the Logger level for specific test blocks. This macro wraps tests inside a describe block, sets up a temporary log level, and restores the original log level afterward. The implementation allows for better auditing in tests but comes with the limitation of potential conflicts with existing describe calls. The author acknowledges this is a personal solution and invites feedback from others.
Related posts
© HashMerge 2025