How to get rid of ellipsis and see everything in IO.inspect()

When we look at the examples there are lines with only '...' that replace some data, see https://www.ash-hq.org/docs/guides/ash/latest/tutorials/get-started#try-our-first-resource-out The truncation seems some behaviour of IO.inspect(). I would like to use IO.inspect() and see everything, even it uses a lot of space. I tried the following code in an exs script with Elixir 1.14.1 (compiled with Erlang/OTP 25) :
Helpdesk.Support.Ticket
|> Ash.Changeset.for_create(:create)
|> IO.inspect(limit: :infinity, printable_limit: :infinity)
|> Helpdesk.Support.create!()
|> IO.inspect(limit: :infinity, printable_limit: :infinity)
Helpdesk.Support.Ticket
|> Ash.Changeset.for_create(:create)
|> IO.inspect(limit: :infinity, printable_limit: :infinity)
|> Helpdesk.Support.create!()
|> IO.inspect(limit: :infinity, printable_limit: :infinity)
The Output is still truncated. I inserted the :limit and :printable_limit options but it does not help. My output:
#Ash.Changeset<
action_type: :create,
action: :create,
attributes: %{},
relationships: %{},
errors: [],
data: #Helpdesk.Support.Ticket<
__meta__: #Ecto.Schema.Metadata<:built, "">,
id: nil,
subject: nil,
aggregates: %{},
calculations: %{},
__order__: nil,
...
>,
valid?: true
>
#Ash.Changeset<
action_type: :create,
action: :create,
attributes: %{},
relationships: %{},
errors: [],
data: #Helpdesk.Support.Ticket<
__meta__: #Ecto.Schema.Metadata<:built, "">,
id: nil,
subject: nil,
aggregates: %{},
calculations: %{},
__order__: nil,
...
>,
valid?: true
>
#Helpdesk.Support.Ticket<
__meta__: #Ecto.Schema.Metadata<:built, "">,
id: "a5f8986c-1c13-42e1-9b41-66649e89ed11",
subject: nil,
aggregates: %{},
calculations: %{},
__order__: nil,
...
>
#Helpdesk.Support.Ticket<
__meta__: #Ecto.Schema.Metadata<:built, "">,
id: "a5f8986c-1c13-42e1-9b41-66649e89ed11",
subject: nil,
aggregates: %{},
calculations: %{},
__order__: nil,
...
>
6 Replies
dj_goku
dj_goku3y ago
IO.inspect(structs: false)
ZachDaniel
ZachDaniel3y ago
Warning: it will be yuge in some cases
dj_goku
dj_goku3y ago
This is seared in my head after wondering the same as you. dbg might not truncate as much. Yuge?
ZachDaniel
ZachDaniel3y ago
Huge 😂 Like lots of output
dj_goku
dj_goku3y ago
Lol oh yeah
kwmiebach
kwmiebachOP3y ago
IO.inspect(structs: false) worked. thanks a lot 🙏 It's a little bit hidden in the elixir docs: :structs - when false, structs are not formatted by the inspect protocol, they are instead printed as maps. Defaults to true. and I still don't understand why the :infinity values did not work

Did you find this page helpful?