lib/semantic_logger/appender/mongodb.rb in semantic_logger-4.6.1 vs lib/semantic_logger/appender/mongodb.rb in semantic_logger-4.7.0
- old
+ new
@@ -1,10 +1,10 @@
-require 'socket'
+require "socket"
begin
- require 'mongo'
+ require "mongo"
rescue LoadError
- raise LoadError.new('Gem mongo is required for logging to MongoDB. Please add the gem "mongo" v2.0 or greater to your Gemfile.')
+ raise LoadError, 'Gem mongo is required for logging to MongoDB. Please add the gem "mongo" v2.0 or greater to your Gemfile.'
end
module SemanticLogger
module Appender
# The Mongo Appender for the SemanticLogger
@@ -102,13 +102,13 @@
#
# application: [String]
# Name of this application to appear in log messages.
# Default: SemanticLogger.application
def initialize(uri:,
- collection_name: 'semantic_logger',
+ collection_name: "semantic_logger",
write_concern: 0,
- collection_size: 1024 ** 3,
+ collection_size: 1024**3,
collection_max: nil,
**args,
&block)
@client = Mongo::Client.new(uri, logger: logger)
@@ -116,10 +116,10 @@
@options = {
capped: true,
size: collection_size,
write: {w: write_concern}
}
- @options[:max] = collection_max if collection_max
+ @options[:max] = collection_max if collection_max
reopen
# Create the collection and necessary indexes
create_indexes