Using Logger.info and Logger.debug in ExUnit tests

By default in the test env, Phoenix doesn't show Logger.debug/Logger.info outputs in the console.
Logger provides 4 printing levels:
- info (allows errors, warns, debugs, infos)
- debug (allows errors, warns, debugs)
- warn (allows errors, warns)
- error (allows errors)
By default the :warn level is turned on. It means that only Logger.warn and Logger.error is printed to the output.
If you'd like to use another two, go to your config/test.exs file and you'll probably see:
# Print only warnings and errors during test
config :logger, level: :warn
Just change the line to the proper level (:debug or :info), and you're ready to go:
# Print all (errors, warnings, debugs and infos) during tests
config :logger, level: :info
Work with a team that keeps learning and building better software every day.
Related posts
Dive deeper into this topic with these related posts
You might also like
Discover more content from this category
There is a common scenario: You'd like to debug your Phoenix app with break!/4 or IEx.pry/0. Everything works fine, until... Phoenix server throws a timeout error statement.
There are a bunch of operations you may want to perform before the rendered response in conn is sent to the client, such as minification. In this post I'll show you how to do it easily.
With pure function React Components you're not allowed to use lifecycle methods like componentDidMount or componentWillUnmount.

