{"id":16701444,"url":"https://github.com/ferd/cth_readable","last_synced_at":"2025-04-13T04:58:21.459Z","repository":{"id":36014143,"uuid":"40308522","full_name":"ferd/cth_readable","owner":"ferd","description":"Common Test hooks for more readable logs","archived":false,"fork":false,"pushed_at":"2025-02-28T02:41:35.000Z","size":86,"stargazers_count":49,"open_issues_count":2,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T04:58:16.535Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ferd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-08-06T14:13:32.000Z","updated_at":"2025-02-28T02:36:33.000Z","dependencies_parsed_at":"2024-06-20T00:22:31.359Z","dependency_job_id":null,"html_url":"https://github.com/ferd/cth_readable","commit_stats":{"total_commits":66,"total_committers":13,"mean_commits":5.076923076923077,"dds":"0.33333333333333337","last_synced_commit":"e39e415a7f31ffbe026770806c0d62e516a26131"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferd%2Fcth_readable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferd%2Fcth_readable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferd%2Fcth_readable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ferd%2Fcth_readable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ferd","download_url":"https://codeload.github.com/ferd/cth_readable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665761,"owners_count":21142123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T18:44:05.760Z","updated_at":"2025-04-13T04:58:21.427Z","avatar_url":"https://github.com/ferd.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `cth_readable`\n\nAn OTP library to be used for CT log outputs you want to be readable\naround all that noise they contain.\n\nThere are currently the following hooks:\n\n1. `cth_readable_shell`, which shows failure stacktraces in the shell and\n   otherwise shows successes properly, in color.\n2. `cth_readable_compact_shell`, which is similar to the previous ones, but\n   only ouputs a period (`.`) for each successful test\n3. `cth_readable_failonly`, which only outputs error and SASL logs to the\n   shell in case of failures. It also provides `cthr:pal/1-4` functions,\n   working like `ct:pal/1-4`, but being silenceable by that hook. A parse\n   transform exists to automatically convert `ct:pal/1-3` into `cthr:pal/1-3`.\n   Also automatically handles lager. This hook buffers the IO/logging events,\n   and the buffer size can be limited with the `max_events` config option. The\n   default value is `inf` which means that all events are buffered.\n4. `cth_readable_nosasl`, which disables all SASL logging. It however requires\n   to be run *before* `cth_readable_failonly` to work.\n\n## What it looks like\n\n![example](http://i.imgur.com/dDFNxZr.png)\n![example](http://i.imgur.com/RXZBG7H.png)\n\n## Usage with rebar3\n\nSupported and enabled by default.\n\n## Usage with  rebar2.x\n\nAdd the following to your `rebar.config`:\n\n```erlang\n{deps, [\n    {cth_readable, {git, \"https://github.com/ferd/cth_readable.git\", {tag, \"v1.6.0\"}}}\n    ]}.\n\n{ct_compile_opts, [{parse_transform, cth_readable_transform}]}.\n{ct_opts, [{ct_hooks, [cth_readable_failonly, cth_readable_shell]}]}.\n%% Or add limitations to how many messages are buffered with:\n%%  {ct_opts, [{ct_hooks, [{cth_readable_failonly, [{max_events, 1000}]}, cth_readable_shell]}]}.\n```\n\n## Usage with lager\n\nIf your lager handler has a custom formatter and you want that formatter\nto take effect, rather than using a configuration such as:\n\n```erlang\n{lager, [\n  {handlers, [{lager_console_backend,\n                [info, {custom_formatter, [{app, \"some-val\"}]}]}\n             ]}\n]}.\n```\n\nUse:\n\n```erlang\n{lager, [\n  {handlers, [{cth_readable_lager_backend,\n                [info, {custom_formatter, [{app, \"some-val\"}]}]}\n             ]}\n]}.\n```\n\nIt will let you have both proper formatting and support for arbitrary\nconfigurations.\n\n## Changelog\n\n1.6.1:\n- Cleaning up some code for OTP-28, mostly around type usage\n\n1.6.0:\n- Adding support for less verbose test skipping (thanks @paulo-ferraz-oliveira)\n\n1.5.1:\n- Adding support for `cthr:pal/5` (thanks @ashleyjlive)\n\n1.5.0:\n- Adding an optional bound buffer in `cth_readable_failonly` (thanks @TheGeorge)\n- (published to hex but never to github, ended up with a messy commit tree)\n\n1.4.9:\n- No change, re-pushing the hex.pm package since it had an untracked dependency somehow\n\n1.4.8:\n- Fixed handling of comments in EUnit macros\n\n1.4.7:\n- Fixed handling of the result of an `?assertNot()` macro\n\n1.4.6:\n- Reloading formatter config for logs after each test where the information needs to be printed\n\n1.4.5:\n- Restoring proper logs for Lager in OTP-21+. A problem existed when `error_logger` was no longer registered by default and lager log lines would silently get lost.\n\n1.4.4:\n- Better interactions with Lager; since newer releases, it removes the Logger default interface when starting, which could cause crashes when this happened before the CT hooks would start (i.e. a eunit suite)\n\n1.4.3:\n- OTP-21.2 support (Logger interface); importing a function that was de-exported by OTP team\n\n1.4.2:\n- OTP-21.0 support (Logger interface)\n\n1.4.1:\n- OTP-21-rc2 support (Logger interface); dropping rc1 support.\n\n1.4.0:\n- OTP-21-rc1 support (Logger interface)\n- Add compact shell output handler\n\n1.3.4:\n- Restore proper eunit assertion formatting\n\n1.3.3:\n- More fixes due to lager old default config formats\n\n1.3.2:\n- Fix deprecation warning on newer lagers due to old default config format\n\n1.3.1:\n- Unicode support and OTP-21 readiness.\n\n1.3.0:\n- display groups in test output. Thanks to @egobrain for the contribution\n\n1.2.6:\n- report `end_per_testcase` errors as a non-critical failure when the test case passes\n- add in a (voluntarily failing) test suite to demo multiple output cases required\n\n1.2.5:\n- support for `on_tc_skip/4` to fully prevent misreporting of skipped suites\n\n1.2.4:\n- unset suite name at the end of hooks run to prevent misreporting\n\n1.2.3:\n- correct `syntax_lib` to `syntax_tools` as an app dependency\n\n1.2.2:\n- fix output for assertions\n\n1.2.1:\n- handle failures of parse transforms by just ignoring the culprit files.\n\n1.2.0:\n- move to `cf` library for color output, adding support for 'dumb' terminals\n\n1.1.1:\n- fix typo of `poplist -\u003e proplist`, thanks to @egobrain\n\n1.1.0:\n- support for better looking EUnit logs\n- support for lager backends logging to HTML files\n\n1.0.1:\n- support for CT versions in Erlang copies older than R16\n\n1.0.0:\n- initial stable release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fferd%2Fcth_readable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fferd%2Fcth_readable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fferd%2Fcth_readable/lists"}