Inspects a value, then strips Ecto bookkeeping noise from the resulting string —
__meta__: #Ecto.Schema.Metadata<…> and #Ecto.Association.NotLoaded<…> — so a
trace shows %Order{id: 12, status: "paid", …} instead of the full Ecto internals.
One value-shaped exception precedes the string cleaning: inspect/2 first
delegates a top-level Ecto.Query value to CodeStory.QueryLabel, which renders
it as a compact #Ecto.Query<Schema> label (at the summary detail levels only).
Everything else follows the string-cleaning path below.
We clean the inspected string, not the value: removing __meta__ from the
value pre-inspect turns the struct into a plain map (%{…, __struct__: Mod}),
losing the %Mod{…} name. CodeStory has no Ecto dependency — detection is purely
string-shaped.
Known limitations
Because this is string-cleaning, not value-cleaning:
- a struct with
__meta__as its only field isn't stripped (no adjacent,) — real schemas always have anid/fields, so this never happens in practice; - a
NotLoadedassociation whose name isn't a bare identifier (\w+) isn't dropped — rare; - a genuine string value that literally contains the full
__meta__: #Ecto.Schema.Metadata<…>field shape would be edited — the unavoidable cost of the chosen approach; low likelihood (a bare#Ecto.Schema.Metadata<…>substring, with no__meta__:prefix, is untouched); - under a compact
:limit, stripping aNotLoaded/nested-struct field can show one fewer real field at that level (only the top-level__meta__slot is compensated by the limit bump below).
Summary
Functions
Like Kernel.inspect/2, but with Ecto __meta__/NotLoaded noise stripped.
Inspect options for a :detail level — full values for :novel, compact otherwise.
The single source of truth both the formatter and the encoder resolve :detail through.
Removes Ecto __meta__ and NotLoaded fragments from an already-inspected string.
Functions
Like Kernel.inspect/2, but with Ecto __meta__/NotLoaded noise stripped.
Inspect options for a :detail level — full values for :novel, compact otherwise.
The single source of truth both the formatter and the encoder resolve :detail through.
Removes Ecto __meta__ and NotLoaded fragments from an already-inspected string.