Sha256: c3512e2f99c08591be8fb11ccd0853aaef6eddf827732249db4f5bd24d47864d
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
# Adapted from https://github.com/le0pard/mongodb_logger module MongoRequestLogger module Adapters class Base attr_reader :configuration, :connection, :connection_type, :collection, :authenticated def collection_name @configuration.collection end def authenticated? @authenticated end def check_for_collection # setup the capped collection if it doesn't already exist create_collection unless @connection.collection_names.include?(collection_name) @collection = @connection[collection_name] end def reset_collection if @connection && @collection @collection.drop create_collection end end def reconnect end def collection_stats_hash(stats) { :is_capped => (stats["capped"] && ([1, true].include?(stats["capped"]))), :count => stats["count"].to_i, :size => stats["size"].to_f, :storageSize => stats["storageSize"].to_f, :db_name => @configuration["database"], :collection => collection_name } end def create_collection raise "Not implemented" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongo_request_logger-0.3.1 | lib/mongo_request_logger/adapters/base.rb |
mongo_request_logger-0.3.0 | lib/mongo_request_logger/adapters/base.rb |