lib/semantic_logger/appender/mongodb.rb in semantic_logger-2.9.0 vs lib/semantic_logger/appender/mongodb.rb in semantic_logger-2.9.1
- old
+ new
@@ -176,11 +176,15 @@
@@host_name = host_name
end
# Log the message to MongoDB
def log(log)
+ # Ensure minimum log level is met, and check filter
+ return false if (level_index > (log.level_index || 0)) || !include_message?(log)
+
# Insert log entry into Mongo
- collection.insert(formatter.call(log), :w=>@write_concern) if level_index <= (log.level_index || 0)
+ collection.insert(formatter.call(log), :w=>@write_concern)
+ true
end
end
end
end
\ No newline at end of file