    # File lib/needle/log-factory.rb, line 141
        def write_to( device, shift_age = 0, shift_size = 1048576 )
          saved_critical = Thread.critical
          Thread.critical = true

          @device.close if @device unless [ $stdout, $stderr ].include?( @device )
          if device.respond_to?( :write ) && device.respond_to?( :close )
            @device = device
          else
            @device = Logger::LogDevice.new( device.to_str,
              :shift_age => shift_age,
              :shift_size => shift_size )
          end

          @loggers.each_value { |logger| logger.write_to( @device ) }
          device

        ensure
          Thread.critical = saved_critical
        end