Sha256: 0c2a8f52f8b9141173d900c096f393e38ffb4674ddcf26945e2f0223397b07cf

Contents?: true

Size: 481 Bytes

Versions: 1

Compression:

Stored size: 481 Bytes

Contents

require 'mongo'

module Nightwatch
  class Mongo
    def initialize(opts = {})
      @host = opts[:host] || '127.0.0.1'
      @port = opts[:port] || 27017
      @database = opts[:database] || 'nightwatch'
    end

    def log(record)
      collection.insert(record)
    end

    private

    def collection
      @collection ||= begin
        mongo = ::Mongo::MongoClient.new(@host, @port)
        mongo[@database]['exceptions']
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nightwatch-0.0.2 lib/nightwatch/mongo.rb