basho/lager — pull request #236 by fishcakez (2014-10-23 22:57:55+00:00)
Title: Add maps support

This is another attempt (#212, #214, #229) at maps support. Unfortunately there is a bug in #214 which can result in a map being printed with a tuple element, e.g. `#{{...}}`.

No capability check is done while formatting maps because releases prior to `17.0` can not produce a term that can reach the (new) final clause for `lager_trunc_io:print/3`. For the same reason on releases including and after `17.0` the first argument must be a map - unless a new type is added in future. However for tests `erlang:is_builtin(erlang, is_map, 1)` is used to avoid map tests on releases < `17.0`, with tests creating maps with `maps:from_list/1` to avoid the new map syntax.

`maps:fold/3` (with `throw/1`) is used to format a map so that once maps gain an efficient fold there is no need to traverse the full map. The format from #214 has been copied.