lib/semantic_logger/appender/mongodb.rb in semantic_logger-4.2.0 vs lib/semantic_logger/appender/mongodb.rb in semantic_logger-4.2.1
- old
+ new
@@ -101,11 +101,11 @@
# Default: SemanticLogger.host
#
# application: [String]
# Name of this application to appear in log messages.
# Default: SemanticLogger.application
- def initialize(uri:, collection_name: 'semantic_logger', write_concern: 0, collection_size: 1024**3, collection_max: nil,
+ def initialize(uri:, collection_name: 'semantic_logger', write_concern: 0, collection_size: 1024 ** 3, collection_max: nil,
level: nil, formatter: nil, filter: nil, host: nil, application: nil, &block)
@client = Mongo::Client.new(uri, logger: logger)
@collection_name = collection_name
@options = {
@@ -142,13 +142,13 @@
def create_indexes
# Create Capped collection
begin
@collection.create
rescue Mongo::Error::OperationFailure
- # Already exists
+ nil
end
- @collection.indexes.create_one({tags: 1})
+ @collection.indexes.create_one(tags: 1)
end
# Purge all data from the capped collection by dropping the collection
# and recreating it.
# Also useful when the size of the capped collection needs to be changed