Skip to content

cth_log_redirect could support more logger configuration #8062

Open
@eproxus

Description

@eproxus

Is your feature request related to a problem? Please describe.
When using cth_log_redirect progress logs get enabled automatically (because of how logger works by default). In some cases, these can get very verbose and increase the size of test logs by megabytes.

The actual case is starting hackney with {ssl_options, tls_certificate_check:options(Host)} which will include all system certificates as binaries in the start arguments. This results in logging megabytes of binary data to the log every time Hackney starts.

Describe the solution you'd like
The module cth_log_redirect should copy additional logger configuration such as filters and filter_default so that one can use e.g. logger_filters:progress/2 as a filter for the test logs.

Describe alternatives you've considered
Completely replace our HTTP client implementation just to avoid blowing up the size of the test logs.

Additional context
Would most likely require minimal changes here:

{DefaultFormatter, DefaultLevel} =
case logger:get_handler_config(default) of
{ok, Default} ->
{maps:get(formatter, Default), maps:get(level, Default)};
_Else ->
{{?DEFAULT_FORMATTER,?DEFAULT_FORMAT_CONFIG},info}
end,
HandlerConfig = #{level => DefaultLevel, formatter => DefaultFormatter},

Would be happy to do a PR if there is agreement that this change is desirable.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions