lib/eco/api/common/people/entry_factory.rb in eco-helpers-3.0.4 vs lib/eco/api/common/people/entry_factory.rb in eco-helpers-3.0.5
- old
+ new
@@ -126,11 +126,11 @@
content, file, encoding, format = kargs.values_at(:content, :file, :encoding, :format)
# Support for multiple file
if file.is_a?(Array)
return file.each_with_object([]) do |f, out|
- logger.info("Parsing file '#{f}'")
+ log(:info) { "Parsing file '#{f}'" }
curr = to_array_of_hashes(**kargs.merge(file: f))
out.concat(curr)
end
end
# Get content only when it's not :xls
@@ -139,11 +139,13 @@
content = get_file_content(file, encoding: encoding)
end
case content
when Hash
- logger.error("Input data as 'Hash' not supported. Expecting 'Enumerable' or 'String'")
+ log(:error) {
+ "Input data as 'Hash' not supported. Expecting 'Enumerable' or 'String'"
+ }
exit(1)
when String
deps = {check_headers: true} if kargs[:check_headers]
to_array_of_hashes(content: person_parser.parse(format, content, deps: deps || {}))
when Enumerable
@@ -219,15 +221,15 @@
end
private
def abort(message)
- logger.error(message)
+ log(:error) { message }
exit(1)
end
def fatal(msg)
- logger.fatal(msg)
+ log(:fatal) { msg }
raise msg
end
end
end
end