[erlang-questions] Architecture question: logging inside library
Loïc Hoguin
essen@REDACTED
Mon Jan 11 14:37:35 CET 2016
Two suggestions:
* Remove all log calls that give you the same information (or less) than
what you could get by tracing.
* After this is done, if some log calls remain, convert them to use
error_logger.
I suspect most of your log calls are not very useful if you use tracing
regularly (worse, they add noise). Your example at least seems to fall
in that category.
On 01/11/2016 08:34 AM, Max Lapshin wrote:
> Hi.
>
> As we know, it is good when library doesn't have any hardcoded
> dependencies at all.
>
> I don't understand what is a good way to remove lager (or any other
> logging library) from library dependencies.
>
>
> For example, we have an mpegts decoder/encoder library. This library
> takes binary and unpacks it to list of frames or packs back:
>
> mpegts_decoder:decode(Binary, mpegts_decoder:init(Options)) -> {ok,
> Frames, State}
>
>
> There are calls to lager in some places of code that are used for
> indicating some statuses:
>
> dump_psi(Decoder, NewPMT),
> lager:info("PMT: ~p", [Descriptors]),
> ...
>
>
> What is the proper way to refuse from adding logger as a dependency for
> such pure library?
> Pass a callback into initialisation options?
>
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
--
Loïc Hoguin
http://ninenines.eu
Author of The Erlanger Playbook,
A book about software development using Erlang
More information about the erlang-questions
mailing list