lib/tanga_services/logger.rb in tanga_services-0.0.7 vs lib/tanga_services/logger.rb in tanga_services-0.0.8
- old
+ new
@@ -44,9 +44,13 @@
log(:fatal, hash)
end
def self.log(level, hash)
fail ArgumentError, 'must have application_name set' unless @logger
+ unless hash.is_a?(Hash)
+ hash = { object: hash }
+ end
+
fail ArgumentError, 'we just log hashes' unless hash.is_a?(Hash)
data = { level: level, object: hash }
@logger.send(level, data.to_json)
end