During code review we decided that using Sink ++ '_lager_event'
would provide better isolation for gen_event names than
Sink ++ '_event' as we had been using up to this point.
For example a sink called 'audit' is now 'audit_lager_event'
than 'audit_event' which might clash with a user's predefined
own module or process name.
Originally I tried to bodge in a handcoded parse transform and it
did not go very well. This time, we simplify the case statement
in lager.erl and use this simplified version in the parse transform
after getting the AST from the Erlang compiler.
The default strategy is 'handle', for backwards compatibility,
and is set to that if otherwise undefined. Other strategies
include 'mirror' and 'ignore'.
Before when the error_logger was removed when lager starts up,
some functionality was chopped off, such as forwarding io to the
caller's group leader, this is supported with the strategy 'ignore'
and is similar to how the io system in erlang works traditionally.
Setting the 'mirror' strategy will essentially combine the other
two strategies such that the remote node reply is forwarded and also
handled locally. This is in some cases more in-line with what some
people might expect, efficiency may vary.
The traditional 'ignore' approach is more suitable and most likely
originally intended for embedded terminals where 'mirror'-ing the io
is largely unnecessary.
Previously, code would only look up the default sink's
loglevel, not the referenced sink name's loglevel.
In other words, if lager_event's loglevel was set to NONE,
it squelch all events from all sinks, and conversely if
a sink's loglevel was set to NONE, it would be silently
ignored.