...

/

Step 4: Add Some Logging

Step 4: Add Some Logging

Learn how events in Elixir can be tracked using a logger.

We'll cover the following...

Imagine a large Elixir application with dozens of processes potentially running across a number of nodes. We’d want a standard way to keep track of significant events as it runs. Enter the Elixir logger. The default mix.exs starts the logger for your application.

def application do 
 [
  extra_applications: [:logger] 
 ]
end

Logger

The logger supports four levels of message. In increasing order of severity, they are debug, info, warn, and error. We select the level of logging in two ways.

First, we can determine at compile time the minimum level of logging include. Logging below this level isn’t even compiled into the code. The ...