Skip to content

Commit acd0c62

Browse files
add a logger option
1 parent d2b931e commit acd0c62

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/salesforce_bulk_api.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111

1212
module SalesforceBulkApi
1313
class Api
14-
attr_reader :connection
14+
attr_reader :connection, :logger
1515

1616
SALESFORCE_API_VERSION = '32.0'
1717

18-
def initialize(client)
18+
def initialize(client, logger = nil)
19+
@logger = logger
1920
@connection = SalesforceBulkApi::Connection.new(SALESFORCE_API_VERSION, client)
2021
@listeners = { job_created: [] }
2122
end

lib/salesforce_bulk_api/job.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def add_batch(keys, batch)
8888
xml += create_sobject(keys, r)
8989
end
9090
xml += '</sObjects>'
91+
logger.info("Xml sent to salesforce: #{xml}") if logger
9192
path = "job/#{@job_id}/batch/"
9293
headers = Hash["Content-Type" => "application/xml; charset=UTF-8"]
9394
response = @connection.post_xml(nil, path, xml, headers)

0 commit comments

Comments
 (0)