Scribe - Pretty print tables of structs and maps

tldr; Now you can do this:

Scribe’s latest v0.6.0 release overrides Inspect for lists and maps. Simply installing the package will enable it, but you can also disable with config :scribe, enable: false if necessary.

Again to reiterate: This will redefine the Inspect protocol. Tread lightly in production.

I wish there was a less hacky solution to implement this, but for now the override is an almost direct copy/paste of source from the Elixir 1.5 and 1.6 branches, modified slightly to use Scribe’s formatter where needed. Suggestions are welcome here if there’s a better solution.

Future Roadmap

  • Proper handling of Inspect.Opts where Scribe’s formatter takes over. Currently the opts are ignored, as I still need to rework Scribe’s formatting opts to accommodate the new functionality. This will be addressed in the next minor release.
  • Scribe.Inspect protocol for your structs to define custom table headers. Printing a struct with too many columns looks terrible if it line wraps.

Feedback is welcome!


@hpopp: This is awesome, great idea!


Thanks for the package! Really cool!!

Can’t wait for a new less intrusive version. I can see you planned it already!

1 Like

v0.8 Released

Inspect overrides are now disabled by default (not even compiled). This will allow you to use Scribe in production Distillery releases again. To re-enable for development, drop the following in your config/dev.exs:

config :scribe,
  compile_auto_inspect: true,
  auto_inspect: true

If you need to temporarily disable auto-inspect, it’s as simple as calling in IEx: