How to use IO.inspect on a long list without trimming it?

See Inspect.Opts for a description of the available options:

  • :limit - limits the number of items that are printed for tuples, bitstrings, maps, lists and any other collection of items. It does not apply to strings nor charlists and defaults to 50. If you don't want to limit the number of items to a particular number, use :infinity.

Thus you can pass limit: :infinity to print all elements:

IO.inspect(list, limit: :infinity)

For strings and charlists there is a special option called :printable_limit. Both of these options can be combined to ensure that all elements are fully printed.


For those who wants this for strings which above solution is not for.

Use printable_limit: integer/:infinity https://hexdocs.pm/elixir/Inspect.Opts.html

Tags:

Elixir