Fix log level signal handler to include :fatal and :error levels.
Issue https://github.com/reidmorrison/semantic_logger/issues/231
Changelog
- Fixed log level signal handler to include fatal and error levels.
Description of changes
The log level changer signal handling was omitting the :fatal and :error levels from the cycle of levels. At first I thought it appeared that way only because the log method used was warn, but when I used STDERR to log the changes I still did not see :fatal and :warn.
The problem was that the code assumed that :error was the highest level, and then subtracted 1 from its level. This code change uses the index boundaries of the LEVELS array to guarantee that the correct sequence of levels is used.
For an easy way to illustrate the problem, check out https://gist.github.com/keithrbennett/006c10128ee3a2f37da98b7f013d3951, which uses stderr output instead of the logger.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.