Logger default_handler vs console

I am using Elixir v1.15.7. In my config.exs file, I configured the Logger’s default handler to use specific colors like so:

colors = [debug: :light_cyan, info: :light_green, warning: :light_yellow, error: :light_red]
config :logger, :default_handler, colors: colors

But it did not work and the default colors are still used.
In order to achieve the desired result, I have to configure the console instead like so:

colors = [debug: :light_cyan, info: :light_green, warning: :light_yellow, error: :light_red]
config :logger, :console, colors: colors

I thought the default handler was replacing the console with v1.15.
Is this the expected behavior?

Thanks

1 Like

After a quick look I would guess that rather than configuring the :deafult_handler you have to configure the :default_formatter

colors = [debug: :light_cyan, info: :light_green, warning: :light_yellow, error: :light_red]

config :logger, :default_formatter,
  colors: colors
2 Likes

Your suggestion is excellent, it works! Many thanks!!