|
|
@ -0,0 +1,19 @@ |
|
|
|
module SemanticLogger |
|
|
|
# Manage a collection of appenders. |
|
|
|
class Appenders < Concurrent::Array |
|
|
|
def close |
|
|
|
closed_appenders = [] |
|
|
|
each do |appender| |
|
|
|
logger.trace "Closing appender: #{appender.name}" |
|
|
|
closed_appenders << appender |
|
|
|
appender.flush |
|
|
|
appender.close |
|
|
|
rescue Exception => e |
|
|
|
logger.error "Failed to close appender: #{appender.name}", e |
|
|
|
end |
|
|
|
# Delete appenders outside the #each above which prevents changes during iteration. |
|
|
|
closed_appenders.each { |appender| delete(appender) } |
|
|
|
logger.trace 'All appenders closed and removed from appender list' |
|
|
|
end |
|
|
|
end |
|
|
|
end |