<div dir="ltr">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 <a href="https://github.com/basho/lager/blob/master/src/lager_transform.erl#L189-L191">https://github.com/basho/lager/blob/master/src/lager_transform.erl#L189-L191</a>).</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 11, 2016 at 1:34 AM, Max Lapshin <span dir="ltr"><<a href="mailto:max.lapshin@gmail.com" target="_blank">max.lapshin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi.<div><br></div><div>As we know, it is good when library doesn't have any hardcoded dependencies at all.<br></div><div><br></div><div>I don't understand what is a good way to remove lager (or any other logging library) from library dependencies.</div><div><br></div><div><br></div><div>For example, we have an mpegts decoder/encoder library. This library takes binary and unpacks it to list of frames or packs back:</div><div><br></div><div>mpegts_decoder:decode(Binary, mpegts_decoder:init(Options)) -> {ok, Frames, State}</div><div><br></div><div><br></div><div>There are calls to lager in some places of code that are used for indicating some statuses:</div><div><div><br></div><div>dump_psi(Decoder, NewPMT),</div></div><div>lager:info("PMT: ~p", [Descriptors]),<br></div><div>...</div><div><br></div><div><br></div><div>What is the proper way to refuse from adding logger as a dependency for such pure library?</div><div>Pass a callback into initialisation options?</div><div><br></div><div><br></div></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>