From 3e6b1ecccccdf9290f71a13969adb3e22e21c909 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Sun, 16 Jul 2017 22:25:50 +0200 Subject: [PATCH] Use new Logger in account module. --- src/accounts/account.component.ts | 11 +++++++---- src/accounts/index.ts | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/accounts/account.component.ts b/src/accounts/account.component.ts index 841799a..027af1b 100644 --- a/src/accounts/account.component.ts +++ b/src/accounts/account.component.ts @@ -1,5 +1,7 @@ import { Observable } from 'rxjs/Rx'; +import { Logger } from '@nsalaun/ng-logger'; + var accountFormTmpl = require('./account.form.tmpl.html'), accountDeleteTmpl = require('./account.delete.tmpl.html'); @@ -9,7 +11,7 @@ import { AccountService } from './account.service'; import { AccountBalancesService } from './accountBalances.service'; export class AccountComponent { - static $inject = ['AccountService', 'AccountBalancesService', 'Notification', '$log', '$modal']; + static $inject = ['AccountService', 'AccountBalancesService', 'Notification', 'Logger', '$modal']; accounts: Account[]; @@ -17,7 +19,7 @@ export class AccountComponent { private AccountService: AccountService, private AccountBalancesService: AccountBalancesService, private Notification, - private $log, + private Logger: Logger, private $modal ) { // Load accounts. @@ -61,6 +63,7 @@ export class AccountComponent { load() { this.AccountService.query().subscribe(accounts => { this.accounts = accounts.map((account: Account) => { + this.Logger.log(account); this.AccountBalancesService .get(account.id) .subscribe((accountBalances: AccountBalances) => { @@ -95,7 +98,7 @@ export class AccountComponent { this.load(); }, result => { - this.$log.error('Error while saving account', account, result); + this.Logger.error('Error while saving account', account, result); this.Notification.error( 'Error while saving account: ' + result.message @@ -157,7 +160,7 @@ export class AccountComponent { this.$modal({ templateUrl: accountFormTmpl, - controller: function($log, $scope, title, account, $save) { + controller: function($scope, title, account, $save) { $scope.title = title; $scope.account = account; $scope.account.authorized_overdraft *= -1; diff --git a/src/accounts/index.ts b/src/accounts/index.ts index e4a3e6f..42c9069 100644 --- a/src/accounts/index.ts +++ b/src/accounts/index.ts @@ -27,6 +27,8 @@ var ngResource = require('angular-resource'), ngUiNotification = require('angular-ui-notification'), ngStrap = require('angular-strap'); +import { Logger } from '@nsalaun/ng-logger'; + var accountsTmpl = require('./accounts.html'); import { AccountBalancesService } from './accountBalances.service'; @@ -40,6 +42,8 @@ export default angular.module('accountant.accounts', [ ngStrap, ]) + .factory('Logger', downgradeInjectable(Logger)) + .factory('AccountBalancesService', downgradeInjectable(AccountBalancesService)) .factory('AccountService', downgradeInjectable(AccountService))