本文整理汇总了TypeScript中aurelia-framework.LogManager类的典型用法代码示例。如果您正苦于以下问题:TypeScript LogManager类的具体用法?TypeScript LogManager怎么用?TypeScript LogManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogManager类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: addDebugLogging
export function addDebugLogging() {
const appenders = LogManager.getAppenders();
if (!appenders || !appenders.length) {
LogManager.setLevel(LogManager.logLevel.error);
LogManager.addAppender(new ConsoleAppender());
}
}
示例2: configure
export function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
LogManager.setLevel(3);
aurelia.start().then(() => aurelia.setRoot("app/App"));
}
示例3: parseGridRow
private parseGridRow(element: any): GridRowAttributes {
// Pull any row attrs into a hash object
var rowsAttributes = new GridRowAttributes();
var rowElement = element.querySelector("grid-row");
if(!rowElement){
LogManager.getLogger("aurelia-grid").warn("Grid has no <grid-row> defined");
return rowsAttributes;
}
var attrs = Array.prototype.slice.call(rowElement.attributes);
attrs.forEach(a => rowsAttributes[a.name] = a.value);
return rowsAttributes;
}
示例4: parseGridCols
private parseGridCols(element: any): GridColumn[] {
var rowElement = element.querySelector("grid-row");
if(!rowElement){
LogManager.getLogger("aurelia-grid").warn("Grid has no <grid-row> defined");
return [];
}
var columnElements = Array.prototype.slice.call(rowElement.querySelectorAll("grid-col"));
var cols = [];
var columnTemplate =
'<span class="grid-column-heading">${$column.heading}</span>' +
'<span if.bind="$column.sorting === \'desc\'" class="${$grid.icons.sortingDesc}"></span>' +
'<span if.bind="$column.sorting === \'asc\'" class="${$grid.icons.sortingAsc}"></span>';
// <grid-col can-sort="true" heading="header"> ..
// or <grid-col can-sort="true"><heading>header template</heading><template>cell template</template>
columnElements.forEach(c => {
var col = new GridColumn();
var attrs = Array.prototype.slice.call(c.attributes);
attrs.forEach(a => this.tryAssign(col, this.camelCaseName(a.name), a.value));
// check for inner <heading> of template
var headingTemplate = c.querySelector("heading");
col.headingTemplate = (headingTemplate && headingTemplate.innerHTML) ? headingTemplate.innerHTML : columnTemplate;
// check for inner content of <template> or use full content as template
var cellTemplate = c.querySelector("template");
col.template = (cellTemplate && cellTemplate.innerHTML) ? cellTemplate.innerHTML : c.innerHTML;
col.init();
cols.push(col);
});
return cols;
}
示例5: configureRouter
import { LogManager } from 'aurelia-framework';
import { RouterConfiguration } from 'aurelia-router';
const logger = LogManager.getLogger('app');
export class App {
configureRouter(config: RouterConfiguration): void {
logger.debug("configuring the router");
config.title = "SKG";
config.map([
{ route: ['', 'home'], name: 'home', moduleId: 'home/home' },
{ route: 'online', name: 'online', moduleId: 'online/online' },
{ route: 'local', name: 'local', moduleId: 'local/local' },
{ route: 'adventure', name: 'adventure', moduleId: 'adventure/adventure' },
{ route: 'skynet', name: 'skynet', moduleId: 'aigame/aigame' }
]);
config.mapUnknownRoutes('home/home');
}
}
示例6: configure
import Cycle from '@cycle/rxjs-run'
import {Observable, Observer, Subscription, BehaviorSubject, ReplaySubject, Subject, Subscriber} from 'rxjs/Rx'
import { DriverFunction } from '@cycle/base'
import {LogManager, FrameworkConfiguration, declarePropertyDependencies, computedFrom, autoinject, Container} from 'aurelia-framework';
import {ViewEngineHooks, View, Controller} from 'aurelia-templating'
import {ContextChanges, ChangeOrigin, ChangeType} from './basic-bindings'
export {Observable, Observer, Subscription, BehaviorSubject, ReplaySubject, Subject} from 'rxjs/Rx'
export * from './basic-bindings'
const logger = LogManager.getLogger('aurelia-plugin-skeleton')
export function configure(frameworkConfig: FrameworkConfiguration) {
const viewResources = frameworkConfig.aurelia.resources
const diContainer = frameworkConfig.container
const hooks = {
beforeBind: function (view: View & {bindingContext; controller: Controller}) {
if (view.controller !== null) {
const context = view.controller.viewModel as any
if (!context || typeof context.cycle !== 'function') return
const count = context._cycleCount = (context._cycleCount || 0) + 1
if (context._cycleCount > 1) {
logger.error('would run the cycle more then once!', count)
return
}
const preparedSources = context.cycleDrivers || {}
const { drivers, onBind, onUnbind, dispose } = makeBindingDrivers(context, diContainer) //observerLocator, strategyLocator, signaler
示例7: getLogger
export function getLogger(moduleId: string): Logger {
return LogManager.getLogger(moduleId);
}
示例8: constructor
constructor() {
this.logger = LogManager.getLogger('notification');
}
示例9: constructor
import {autoinject, LogManager} from 'aurelia-framework';
import {EventAggregator} from 'aurelia-event-aggregator';
import {NavigationInstruction, Router, RouterConfiguration} from 'aurelia-router';
import {AuthPlugin} from 'auth-plugin';
let logger = LogManager.getLogger('ROUTER');
@autoinject
export default class {
constructor(private router: Router, private eventAggregator: EventAggregator) {
}
prepare() {
if (this.router.isConfigured) {
return;
}
this.router.configure((config: RouterConfiguration) => {
config.title = 'Aurelia';
config.map([
{ route: ['', 'login'], name: 'login', moduleId: 'login' },
{ route: 'page1', name: 'page1', moduleId: 'page1', settings: { auth: true } },
{ route: 'page2', name: 'page2', moduleId: 'page2', settings: { auth: true } }
]);
config.addAuthorizeStep(AuthPlugin);
return config;
});
let callback = (eventArgs: Object, name) => {
logger.warn(eventArgs['instruction']['config']['name'], name);
示例10: configure
import {BindingFunction} from 'aurelia-binding-functions'
import {LogManager, FrameworkConfiguration} from 'aurelia-framework'
import {CallScope, Scope, getContextFor, Binding, Listener, Expression} from 'aurelia-binding'
import {View} from 'aurelia-templating'
import {sourceContext} from 'aurelia-binding'
// import {Observable, Observer, Subscription, ReplaySubject, BehaviorSubject, Subject} from 'rxjs/Rx'
const logger = LogManager.getLogger('aurelia-rxjs')
export function configure(frameworkConfig: FrameworkConfiguration) {
const viewResources = frameworkConfig.aurelia.resources
const bindingBehaviorInstance = frameworkConfig.container.get(ObservableSignalBindingBehavior)
viewResources.registerBindingBehavior('observableSignal', bindingBehaviorInstance)
const rxBindingFunctionInstance = frameworkConfig.container.get(RxBindingFunction)
if (typeof viewResources.registerBindingFunction === 'function') {
viewResources.registerBindingFunction('@rx', rxBindingFunctionInstance)
} else {
throw new Error('You need to load the aurelia-binding-functions plugin before aurelia-observable-binding-function.')
}
}
export class RxBindingFunction implements BindingFunction {
connect(callScope: CallScope, binding: Binding, scope: Scope) {
logger.debug('[connect] start connect for VALUE:', callScope.args[0].name)
const observable = callScope.args[0].evaluate(scope, binding.lookupFunctions, true) //as Subject<any | ChangeWithMetadata<any>>
if (observable && typeof observable.subscribe === 'function') {
// observe the underlying property to trigger when inner value changed (eg. if an array - observe its changes)