Skip to content

Commit

Permalink
implemented info level logging for all methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dnbasta committed Feb 29, 2024
1 parent 6a45c4d commit 3234ca8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ynabapiimport/ynabapiimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,19 @@ def import_transactions(self, startdate: date = None, memo_regex: str = None) ->

def create_auth_link(self, institution_id: str) -> str:
auth_link = self._gocardless_client.create_requisition_auth_link(institution_id=institution_id)
self.logger.info(f'created auth link for {institution_id} under reference {self._gocardless_client.reference}')
return auth_link

def fetch_institutions(self, countrycode: str) -> List[dict]:
return self._gocardless_client.get_institutions(countrycode=countrycode)
institutions = self._gocardless_client.get_institutions(countrycode=countrycode)
self.logger.info(f'fetched list with {len(institutions)} institutions for countrycode {countrycode}')
return institutions

def test_memo_regex(self, memo_regex: str) -> List[dict]:
transactions = self._gocardless_client.fetch_transactions()
mc = MemoCleaner(memo_regex=memo_regex)
r = [{t.memo: mc.clean(t).memo} for t in transactions]
self.logger.info('results of applied regex to memo in form of: [{original_memo: cleaned_memo}]')
self.logger.info(json.dumps(r, indent=4))
self.logger.info(f'tested memo regex on {len(r)} transactions from {self._gocardless_client.reference}')
return r

@staticmethod
Expand Down

0 comments on commit 3234ca8

Please sign in to comment.