Improve invoice processing logging

This commit is contained in:
Alex Sherman 2020-10-16 14:53:54 +05:00
parent 25a7f7168f
commit c744a81e4c
3 changed files with 13 additions and 3 deletions

View file

@ -71,7 +71,7 @@ gem 'airbrake'
gem 'company_register', github: 'internetee/company_register',
branch: 'master'
gem 'e_invoice', github: 'internetee/e_invoice', branch: :master
gem 'lhv', github: 'internetee/lhv', branch: 'master'
gem 'lhv', github: 'internetee/lhv', branch: '1712-improve-logging-autotopup-fix'
gem 'domain_name'
gem 'haml', '~> 5.0'
gem 'wkhtmltopdf-binary', '~> 0.12.5.1'

View file

@ -45,8 +45,8 @@ GIT
GIT
remote: https://github.com/internetee/lhv.git
revision: 1825240b3bf8b262418cc6c8ef7ed1aba386dd7d
branch: master
revision: 3f27d87dddd16b7ef9fc6502f048f1a6718750dc
branch: 1712-improve-logging-autotopup-fix
specs:
lhv (0.1.0)
logger

View file

@ -23,6 +23,9 @@ namespace :invoices do
end
if incoming_transactions.any?
log 'Got incoming transactions'
log incoming_transactions
bank_statement = BankStatement.new(bank_code: Setting.registry_bank_code,
iban: Setting.registry_iban)
@ -41,8 +44,15 @@ namespace :invoices do
transaction.autobind_invoice
end
end
else
log 'Got no incoming transactions parsed, aborting'
end
puts "Transactions processed: #{incoming_transactions.size}"
end
def log(msg)
@log ||= Logger.new(STDOUT)
@log.info(msg)
end
end