[erlang-questions] Architecture question: logging inside library

Unix One <>
Mon Jan 11 17:33:56 CET 2016


On 01/10/2016 11:34 PM, Max Lapshin wrote:

>
> What is the proper way to refuse from adding logger as a dependency for
> such pure library?
> Pass a callback into  initialisation options?

What is a use case for logging? Logging is a side effect. If you want to 
have a pure library, you should always return the result and let the 
caller handle it - consume, forward, log, etc.

I would advise to not hack an unrelated, side-effect dependency into a 
pure library by any means.


More information about the erlang-questions mailing list