diff --git a/CHANGELOG.md b/CHANGELOG.md index 0324486..b7a514e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,11 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [unreleased] + +## [4.16.1] + - Add Honeybadger and Honeybadger Insights to Appenders doc. +- Fix regression in `SemanticLogger::Appenders#close` ## [4.16.0] diff --git a/lib/semantic_logger/appenders.rb b/lib/semantic_logger/appenders.rb index 3f5f887..1a35256 100644 --- a/lib/semantic_logger/appenders.rb +++ b/lib/semantic_logger/appenders.rb @@ -49,9 +49,9 @@ def close closed_appenders = [] each do |appender| logger.trace "Closing appender: #{appender.name}" - appenders << appender appender.flush appender.close + closed_appenders << appender rescue Exception => e logger.error "Failed to close appender: #{appender.name}", e end diff --git a/test/appenders_test.rb b/test/appenders_test.rb index 6ffdc01..9b9c05c 100644 --- a/test/appenders_test.rb +++ b/test/appenders_test.rb @@ -100,5 +100,16 @@ class AppendersTest < Minitest::Test # assert_instance_of SemanticLogger::Appender::Async, appender # end end + + describe "#close" do + it "closes appenders" do + appender = appenders.add(file_name: "test.log") + + appenders.close + + assert_equal 0, capture_logger.events.count { |it| it.message.match?(/failed/i) } + assert_equal 0, appenders.size + end + end end end