Pretty printing Phoenix request parameters

By default, the Phoenix.Logger prints some useful information about each received request.
Turns out that (at least in development) the color and the log format is not very legible and difficult to find among other log entires.

I was wondering if there is a way to customize how this information is displayed, or if the Phoenix team would be open to a proposition to update it.

This is a screenshot I’ve took that shows what I mean.

I can’t really read anything on the screenshot.

But what I can see is, that it seems that there are some pretty printed single value spanning many lines.

From the point of aggregating logs via ELK or similar, I really do not like spanning single log entries over more than a single line.

If though you really want that, you can provide a custom formatter that does this for you as you want it.


edit

The screenshot has been updated splitseconds after I submitted the post. Its now better readable, but doesn’t really change my thinking about the problem at hand.

AFAIK it is not currently possible to change Phoenix.Logger format in any way. Maybe in future, when structured logging in Elixir will became a thing it will change, but for now I am not aware of any way to help You.

As this is local development output (as it outputs blue debug messages) it shouldn’t be a problem, as the production format can be completely different.

You should be able to use Kernel.inspect/2 to pretty print conn:
Logger.debug inspect(conn)