本文整理汇总了TypeScript中helpers/logger/logger.ILogger类的典型用法代码示例。如果您正苦于以下问题:TypeScript ILogger类的具体用法?TypeScript ILogger怎么用?TypeScript ILogger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ILogger类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: return
return (exception: any, cause: any) => {
$delegate(exception, cause);
let logger: ILogger = $injector.get('logger').getLogger('exceptionHandler');
let $analytics: angulartics.IAnalyticsService = $injector.get('$analytics');
let message: string = exception + (cause ? ' (' + cause + ')' : '');
logger.error(message);
$analytics.eventTrack('Exception', { category: 'error', value: message });
};
示例2:
_.each(artist.sets, (set: Set) => {
let notificationExist = _.find(notifications, notification => JSON.parse(notification.data).id === set.id);
this.logger.log('exist: ' + notificationExist + ' || ' + set.id);
// Use "real" set date to use setup notification based on device local date
let setNotificationDate = this.moment(set.start).subtract(NOTIFY_BEFORE_MIN, 'minutes');
let inFuture = setNotificationDate.isAfter(now);
this.logger.log('inFuture: ' + inFuture + ' || ' + set.start);
if (set.start && !notificationExist && inFuture) {
this.logger.log(`Adding notification for artist: ${id}, set: ${set.start}`);
this.$cordovaLocalNotification.schedule({
id: '' + this.getId(), // ID needs to be a string convertible to an integer
smallicon: 'res://drawable/ic_notification_hadra',
icon: 'res://drawable/ic_notification_hadra',
color: this.config.notificationColor,
led: this.config.notificationColor,
text: this.gettextCatalog.getString('{{name}} {{type}} set starts in 10 minutes on {{scene}} floor!', {
name: set.artist.name,
type: set.type,
scene: set.scene.name
}),
data: Set.getSerializableCopyWithId(set),
at: setNotificationDate.toDate(),
});
}
});
示例3: inject
/**
* Injects the specified context into the given REST API.
* The REST API should be formatted like "/api/users/:userId".
* Any fragment from the REST API starting with ":" will then be replaced by a property from the context with
* the same name, i.e. for "/api/users/:userId" and a context object "{ userId: 123 }", the resulting URL will
* be "/api/users/123".
* @param {!string} restApi The REST API to fill will context values.
* @param {Object} context The context to use.
* @return {string} The ready-to-use REST API to call.
*/
inject(restApi: string, context?: any): string {
this.logger.log('Injecting context in: ' + restApi);
if (!context) {
throw 'inject: context must be defined';
}
// Search for context properties to inject
let properties = restApi.match(/(:\w+)/g);
angular.forEach(properties, (property: string) => {
let contextVar = property.substring(1);
let contextValue = context[contextVar];
if (contextValue !== undefined) {
contextValue = encodeURIComponent(contextValue);
restApi = restApi.replace(property, contextValue);
this.logger.log('Injected ' + contextValue + ' for ' + property);
} else {
throw 'inject: context.' + contextVar + ' expected but undefined';
}
});
this.logger.log('Resulting REST API: ' + restApi);
return restApi;
}
示例4: onTrigger
private onTrigger(event: any, notification: any) {
this.logger.log('notification triggered');
if (this.$rootScope['foreground']) {
this.toastService.show(notification.text);
}
}
示例5: constructor
constructor($scope: ng.IScope,
$stateParams: angular.ui.IStateParamsService,
private $cordovaInAppBrowser: any,
private moment: moment.MomentStatic,
private gettextCatalog: angular.gettext.gettextCatalog,
logger: LoggerService,
private festivalService: FestivalService,
private playerService: PlayerService,
private favoritesService: FavoritesService,
private toastService: ToastService) {
this.logger = logger.getLogger('artist');
this.logger.log('init');
this.noBio = gettextCatalog.getString('No bio');
this.favorites = this.favoritesService.favorites;
// Init each time, because of view cache
$scope.$on('$ionicView.beforeEnter', () => {
let artistId = $stateParams['artistId'];
this.logger.log('artistId', artistId);
this.artist = this.festivalService.festival.artistById[artistId];
});
}
示例6: constructor
constructor(logger: LoggerService,
config: IApplicationConfig) {
this.logger = logger.getLogger('about');
this.version = config.version;
this.logger.log('init');
}
示例7: encodeURIComponent
angular.forEach(properties, (property: string) => {
let contextVar = property.substring(1);
let contextValue = context[contextVar];
if (contextValue !== undefined) {
contextValue = encodeURIComponent(contextValue);
restApi = restApi.replace(property, contextValue);
this.logger.log('Injected ' + contextValue + ' for ' + property);
} else {
throw 'inject: context.' + contextVar + ' expected but undefined';
}
});
示例8: constructor
constructor(private $state: ng.ui.IStateService,
$locale: ng.ILocaleService,
private _: _.LoDashStatic,
config: IApplicationConfig,
logger: LoggerService) {
this.currentLocale = $locale;
this.logger = logger.getLogger('shell');
this.languages = config.supportedLanguages;
this.menuHidden = true;
this.logger.log('init');
}
示例9: constructor
constructor($scope: ng.IScope,
$stateParams: angular.ui.IStateParamsService,
private $cordovaInAppBrowser: any,
festivalService: FestivalService,
logger: LoggerService) {
this.logger = logger.getLogger('infoController');
this.logger.log('init');
// Init each time, because of view cache
$scope.$on('$ionicView.beforeEnter', () => {
let infoId = $stateParams['infoId'];
this.logger.log('infoId', infoId);
this.info = festivalService.festival.infos[infoId];
});
}