restforce-db 2.1.5 → 2.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2214ab04231e0cbbc83e59248f3f3ec794c01c4
4
- data.tar.gz: 560a485242bce00d2b9d219c8775c6854736bb59
3
+ metadata.gz: f345da89828f81e0461a71a5e552ead233095c5b
4
+ data.tar.gz: 8f4d3d95e22cb4f56eadef22022bd8878c4db60b
5
5
  SHA512:
6
- metadata.gz: cbde0d9e95daf9e7eace6492aa9fb3a552bc766c807b34db2ea24ef369b8471651784244b767024db2b8d3e1f904b4e2d3cb4325d85b8a6c325515a0233fbf87
7
- data.tar.gz: 928e76319b07d113d6d551a4128307ed4d63bc77c3fcf104201fff6fe2aa25167fbd49f508640ae166b97ae4d1e464718ccff23948eafd63a92353626dc584db
6
+ metadata.gz: 04321dac381dc1ca4f06a2b625c5f317426422ee8d94fa89382e2a6a76ee07550d3c2ed041464998c72a09f3e9bea7f2e683b13c2c911f3d5bec039f0f6d93d5
7
+ data.tar.gz: 96db605dd20e59b25ba5dd2a7725ef26dc7f1a4e3e24de7d030dfa012d3f68c2da39bb8958e7a305124f949273390fb2a85934e07c0c2312bc3636ff70f8244b
@@ -74,7 +74,7 @@ module Restforce
74
74
  database_record.save!
75
75
  end
76
76
  rescue ActiveRecord::ActiveRecordError, Faraday::Error::ClientError => e
77
- DB.logger.error("#{e.message}\n#{e.backtrace.join("\n")}")
77
+ DB.logger.error(e)
78
78
  end
79
79
 
80
80
  # Internal: Get a Hash of associated lookup IDs for the passed database
@@ -118,8 +118,21 @@ module Restforce
118
118
  # Returns a Logger.
119
119
  def logger
120
120
  @logger ||= Logger.new(@options[:logfile]).tap do |logger|
121
- logger.formatter = proc do |severity, datetime, _progname, msg|
122
- "#{severity} [#{datetime.strftime('%Y-%m-%d %H:%M:%S')}] #{msg}\n"
121
+ logger.formatter = proc do |severity, datetime, _progname, message|
122
+ # Implementation taken from Ruby's msg2str.
123
+ # See: http://apidock.com/ruby/Logger/Formatter/msg2str
124
+ formatted =
125
+ case message
126
+ when ::String
127
+ message
128
+ when ::Exception
129
+ backtrace = message.backtrace || []
130
+ "#{message.message} (#{message.class})\n#{backtrace.join("\n")}"
131
+ else
132
+ message.inspect
133
+ end
134
+
135
+ "#{severity} [#{datetime.strftime('%Y-%m-%d %H:%M:%S')}] #{formatted}\n"
123
136
  end
124
137
  end
125
138
  end
@@ -43,7 +43,7 @@ module Restforce
43
43
  return unless @strategy.build?(instance)
44
44
  @mapping.database_record_type.create!(instance)
45
45
  rescue ActiveRecord::ActiveRecordError => e
46
- DB.logger.error("#{e.message}\n#{e.backtrace.join("\n")}")
46
+ DB.logger.error(e)
47
47
  end
48
48
 
49
49
  # Internal: Attempt to create a partner record in Salesforce for the
@@ -57,7 +57,7 @@ module Restforce
57
57
  return if instance.synced?
58
58
  @mapping.salesforce_record_type.create!(instance)
59
59
  rescue Faraday::Error::ClientError => e
60
- DB.logger.error("#{e.message}\n#{e.backtrace.join("\n")}")
60
+ DB.logger.error(e)
61
61
  end
62
62
 
63
63
  end
@@ -56,7 +56,7 @@ module Restforce
56
56
 
57
57
  instance.update!(attributes)
58
58
  rescue ActiveRecord::ActiveRecordError, Faraday::Error::ClientError => e
59
- DB.logger.error("#{e.message}\n#{e.backtrace.join("\n")}")
59
+ DB.logger.error(e)
60
60
  end
61
61
 
62
62
  end
@@ -3,7 +3,7 @@ module Restforce
3
3
  # :nodoc:
4
4
  module DB
5
5
 
6
- VERSION = "2.1.5"
6
+ VERSION = "2.1.6"
7
7
 
8
8
  end
9
9
 
@@ -220,7 +220,7 @@ module Restforce
220
220
  #
221
221
  # Returns nothing.
222
222
  def error(exception)
223
- log "#{exception.message}\n#{exception.backtrace.join("\n")}", :error
223
+ logger.error(exception)
224
224
  end
225
225
 
226
226
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restforce-db
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.5
4
+ version: 2.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Horner