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.

Table of contents

    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
    Oskar Legner
    Oskar Legner Elixir & React Developer

    Read more
    on #curiosum blog

    Elixir Trickery: Using Macros and Metaprogramming Without Superpowers

    Elixir Trickery: Using Macros and Metaprogramming Without Superpowers

    There's hardly any more misunderstood element of Elixir than its metaprogramming power. The way to understand it is actually not to try too hard to wrap your head around it.

    Elixir is a language heavily relying on its macro mechanism, which is both powerful and limited, and both complicated and simple, at the same time. The good news is that when you get to know the simple part about it, it's very easy to start writing macros even if you're a complete noob - and I'm going to give you plenty of examples to demonstrate that.

    Modern Talking with Elixir: Messenger App Tutorial with Phoenix LiveView

    Modern Talking with Elixir: Messenger App Tutorial with Phoenix LiveView

    Have you ever wondered why Elixir and its ecosystem is gradually becoming the go-to platform for many web application developers who want both performance and productivity, not a tradeoff between them?

    Well, we'll show you why - and we'll do it via a thorough crash course of Phoenix Framework's hot deal, Phoenix LiveView, using which we'll build a Messenger-like live chat application.

    As of November 2020, the latest Phoenix LiveView version is 0.14.8 - and the series has been updated to match it!