log_stream (Merb)

    # File lib/merb-core.rb, line 371
        def log_stream(port = "main")
          port = :test if Merb.testing?
          @streams ||= {}
          @streams[port] ||= begin
            log = if Merb.testing?
              log_path / "merb_test.log"
            elsif !Merb::Config[:daemonize] && !Merb::Config[:force_logging]
              STDOUT
            else
              log_path / "merb.#{port}.log"
            end

            if log.is_a?(IO)
              stream = log
            elsif File.exist?(log)
              stream = File.open(log, (File::WRONLY | File::APPEND))
            else
              FileUtils.mkdir_p(File.dirname(log))
              stream = File.open(log, (File::WRONLY | File::APPEND | File::CREAT))
              stream.write("#{Time.now.httpdate} #{Merb::Config[:log_delimiter]} " \
                "info #{Merb::Config[:log_delimiter]} Logfile created\n")
            end
            stream.sync = true
            stream
          end
        end