lib/eco/api/common/people/person_entry.rb in eco-helpers-3.0.4 vs lib/eco/api/common/people/person_entry.rb in eco-helpers-3.0.5
- old
+ new
@@ -2,10 +2,11 @@
module API
module Common
module People
class PersonEntry
DEBUG = false
+ include Eco::Language::AuxiliarLogger
# This class is meant to provide a common interface to access entries of source data that come in
# different formats.
# @note
# - if `data` is a `Person` object, its behaviour is `serialise`.
@@ -215,11 +216,12 @@
scoped_attrs -= ['id']
@final_entry.slice(*scoped_attrs).each do |attr, value|
set_part(person, attr, value)
rescue StandardError => e
raise unless attr == "email"
- logger.error("#{e} - setting blank email instead.")
+
+ log(:error) { "#{e} - setting blank email instead." }
set_part(person, attr, nil)
end
end
# Setter to fill in the `account` properties of the `Person` that are present in the `Entry`.
@@ -513,15 +515,11 @@
return value if value.is_a?(Hash)
{ attr => value }
end
# LOGGER
- def logger
- @logger || ::Logger.new(IO::NULL)
- end
-
def fatal(msg)
- logger.fatal(msg)
+ log(:fatal) { msg }
raise msg
end
# Function to debug faste
def print_models