What is the preferred way to provide default options for IO.inspect? I am reading about Inspect.Opts but I can’t find a concrete example how to use it for existing things.
Also is there any way to add a file, something like the .iex.exs
file with default options for the IO.inspect to pick up and use them?
My specific problem is that I would like to have colorized output for the inspected terms but I don’t want to add the options every time I call IO.inspect
. I would prefer to create a file once and use it in every project.
I did create a ~/.iex.exs
with this content for testing
IEx.configure(
colors: [
syntax_colors: [
number: :light_yellow,
atom: :light_cyan,
string: :light_black,
boolean: :red,
nil: [:magenta, :bright]
],
ls_directory: :cyan,
ls_device: :yellow,
doc_code: :green,
doc_inline_code: :magenta,
doc_headings: [:cyan, :underline],
doc_title: [:cyan, :bright, :underline]
]
)
but this has effect only in iex. When I run dev or test the output is still white on black.