cth_readable

An OTP library to be used for CT log outputs you want to be readable around all that noise they contain.

There are currently the following hooks:

  1. cth_readable_shell, which shows failure stacktraces in the shell and otherwise shows successes properly, in color.
  2. cth_readable_compact_shell, which is similar to the previous ones, but only ouputs a period (.) for each successful test
  3. cth_readable_failonly, which only outputs error and SASL logs to the shell in case of failures. It also provides cthr:pal/1-4 functions, working like ct:pal/1-4, but being silenceable by that hook. A parse transform exists to automatically convert ct:pal/1-3 into cthr:pal/1-3. Also automatically handles lager. This hook buffers the IO/logging events, and the buffer size can be limited with the max_events config option. The default value is inf which means that all events are buffered.
  4. cth_readable_nosasl, which disables all SASL logging. It however requires to be run beforecth_readable_failonly to work.

What it looks like

exampleexample

Usage with rebar3

Supported and enabled by default.

Usage with rebar2.x

Add the following to your rebar.config:

{deps, [
    {cth_readable, {git, "https://github.com/ferd/cth_readable.git", {tag, "v1.6.0"}}}
    ]}.

{ct_compile_opts, [{parse_transform, cth_readable_transform}]}.
{ct_opts, [{ct_hooks, [cth_readable_failonly, cth_readable_shell]}]}.
%% Or add limitations to how many messages are buffered with:
%%  {ct_opts, [{ct_hooks, [{cth_readable_failonly, [{max_events, 1000}]}, cth_readable_shell]}]}.

Usage with lager

If your lager handler has a custom formatter and you want that formatter to take effect, rather than using a configuration such as:

{lager, [
  {handlers, [{lager_console_backend,
                [info, {custom_formatter, [{app, "some-val"}]}]}
             ]}
]}.

Use:

{lager, [
  {handlers, [{cth_readable_lager_backend,
                [info, {custom_formatter, [{app, "some-val"}]}]}
             ]}
]}.

It will let you have both proper formatting and support for arbitrary configurations.

Changelog

1.6.1:

1.6.0:

1.5.1:

1.5.0:

1.4.9:

1.4.8:

1.4.7:

1.4.6:

1.4.5:

1.4.4:

1.4.3:

1.4.2:

1.4.1:

1.4.0:

1.3.4:

1.3.3:

1.3.2:

1.3.1:

1.3.0:

1.2.6:

1.2.5:

1.2.4:

1.2.3:

1.2.2:

1.2.1:

1.2.0:

1.1.1:

1.1.0:

1.0.1:

1.0.0: