-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add loglevel instead of using console.log
- Loading branch information
1 parent
de332f1
commit 2fec074
Showing
5 changed files
with
30 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import {AccountsResponseData, TransactionsResponse} from "ynab"; | ||
import {YnabAPI} from "../api"; | ||
import log from "loglevel"; | ||
|
||
export type ynabTransactionResponse = (TransactionsResponse & {rateLimit: string | null;}) | undefined; | ||
|
||
export async function scheduledAccountBalanceUpdate(ynab: YnabAPI): Promise<AccountsResponseData> { | ||
console.log(`Starting scheduled account balance update at ${new Date().toLocaleString()} ...`); | ||
log.info(`Starting scheduled account balance update at ${new Date().toLocaleString()} ...`); | ||
const accounts = await ynab.client.accounts.getAccounts(ynab.budgetId); | ||
console.log(`Fetched balances for ${accounts.data.accounts.length} accounts.`); | ||
console.log(`Rate limit: ${accounts.rateLimit}`); | ||
log.info(`Fetched balances for ${accounts.data.accounts.length} accounts.`); | ||
log.info(`Rate limit: ${accounts.rateLimit}`); | ||
return accounts.data; | ||
} |