* If the shaper is in overload and the final message comes in, but no
further messages arrive for some time, until another message came in,
the drop count would not be printed. Now we set a timer to ensure it
prints the drop count after the current second expires.
* Allow the shaper to take a filter function that allows events that
would not normally be printed anyway to not be counted against the
HWM. This means that if you're suppressing supervisor startup messages
you won't see drop events counted for messages you'd never see
printed.
Previously the following configuration didn't work properly:
{log_root, "logs"},
{handlers, [{lager_file_backend, [{file, "access.log"}, {level, none}, ...]}]},
{traces, [{{lager_file_backend, "access.log"}, [{tag, access}], info}]}
When lager:trace_file was trying to find a file among the existing
handlers, it was searching for the expanded file name
("logs/access.log"), but the handlers store the file names without
expansion ("access.log"), so it didn't find it.
The result was that lager:trace_file started another "access.log"
backend, which of course didn't use e.g. the log rotation settings of
the first handler. When the log_root was relative, then each log
message appeared twice in the log file (both backends thought that they
should log it, because when calculating the Destination,
"logs/access.log" was used in both cases).
Now the code performs path expansion on the file name inside the handler
too. Also, now it calculates the absolute paths of both files, so that
if one file is specified with an absolute path and the other with a
relative path, lager will still know that they are the same.
Test
----
Using the old code (tag 3.2.4 was tested) the new test usually fails the
following way:
module 'lager_trace_test'
lager_trace_test: trace_test_ (Trace combined with log_root)...*failed*
in function lager_trace_test:'-trace_test_/0-fun-6-'/0 (test/lager_trace_test.erl, line 71)
**throw:{too_many_entries,{ok,<<"Test message\n2017-03-26 23:04:23.935 [info] <0.5898.0>@lager"...>>}}
output:<<"">>
The reason for failing only usually is that it might happen that the
duplicate log entry is added to file only after we called
time:sleep(1000) and checked that the log entry is not there.
Don't use dirty timeout for gen_statem
That was introduced in OTP 19.2, and causes
failures in tests on OTP 19 and 19.1
Fix statem for all 19.x releases