lib/logging.rb in logging-0.6.1 vs lib/logging.rb in logging-0.6.2
- old
+ new
@@ -1,6 +1,6 @@
-# $Id: logging.rb 80 2008-01-01 22:39:52Z tim_pease $
+# $Id: logging.rb 85 2008-02-06 17:59:00Z tim_pease $
require 'logging/utils'
require 'logging/log_event'
require 'logging/logger'
require 'logging/root_logger'
@@ -28,11 +28,11 @@
#
#
module Logging
- VERSION = '0.6.1' # :nodoc:
+ VERSION = '0.6.2' # :nodoc:
LEVELS = {} # :nodoc:
LNAMES = {} # :nodoc:
class << self
@@ -252,7 +252,17 @@
end
# :startdoc:
end
end # module Logging
+
+# This exit handler will close all the appenders that exist in the system.
+# This is needed for closing IO streams and connections to the syslog server
+# or e-mail servers, etc.
+#
+at_exit {
+ Logging::Appender.instance_variable_get(:@appenders).values.each do |ap|
+ ap.close
+ end
+}
# EOF