lib/ougai/logging.rb in ougai-1.5.4 vs lib/ougai/logging.rb in ougai-1.5.5

- old
+ new

@@ -78,10 +78,16 @@ # Creates a child logger and returns it. # @param fields [Hash] The fields appending to all logs # @return [ChildLogger] A created child logger def child(fields = {}) - ChildLogger.new(self, fields) + ch = ChildLogger.new(self, fields) + + if !block_given? + ch + else + yield ch + end end # @private def chain(_severity, _args, _fields, _hooks) raise NotImplementedError