lib/logging.rb in TwP-logging-1.1.3 vs lib/logging.rb in TwP-logging-1.1.4
- old
+ new
@@ -20,11 +20,11 @@
#
#
module Logging
# :stopdoc:
- VERSION = '1.1.3'
+ VERSION = '1.1.4'
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
LEVELS = {}
LNAMES = []
# :startdoc:
@@ -450,10 +450,16 @@
# Internal logging method for use by the framework.
def log_internal( level = 1, &block )
::Logging::Logger[::Logging].__send__(levelify(LNAMES[level]), &block)
end
+
+ # Close all appenders
+ def shutdown
+ log_internal {'shutdown called - closing all appenders'}
+ ::Logging::Appenders.each {|appender| appender.close}
+ end
# :startdoc:
end
end # module Logging
@@ -473,13 +479,10 @@
# 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.log_internal {'at_exit hook called - closing all appenders'}
- Logging::Appenders.each {|appender| appender.close}
-}
+at_exit {Logging.shutdown}
end # unless defined?
# EOF