[erlang-questions] Architecture question: logging inside library
Sean Cribbs
seancribbs@REDACTED
Tue Jan 12 04:00:33 CET 2016
You may need lager at compile-time, but there's no reason you have to start
it (i.e. don't include it in your 'applications' in the .app). If you use
the parse_transform as your snippet suggests, it will simply not do
anything if the sink is not running (see
https://github.com/basho/lager/blob/master/src/lager_transform.erl#L189-L191
).
On Mon, Jan 11, 2016 at 1:34 AM, Max Lapshin <max.lapshin@REDACTED> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160111/dc4b5df4/attachment.htm>
More information about the erlang-questions
mailing list