本文整理汇总了TypeScript中aurelia-logging.getLogger函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getLogger函数的具体用法?TypeScript getLogger怎么用?TypeScript getLogger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getLogger函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: isOverride
export function isOverride(key: string) {
const val = key.charAt(0) === overrideMarker;
getLogger('aurelia-json-schema-form')
.info('isOverride', { key, val });
return val;
}
示例2: configure
export function configure(frameworkConfig: FrameworkConfiguration, callback?: (config: PluginOptions) => void) {
const logger = getLogger('aurelia-json-schema-form');
logger.info('initializing aurelia-json-schema-form');
// create defaults/apply user defined configuration
const options = new PluginOptions();
if (callback instanceof Function) {
callback(options);
}
registerLogger(logger, options, frameworkConfig);
registerConfiguration(logger, options, frameworkConfig);
(frameworkConfig.container.get(RulesFactory) as RulesFactory).register();
frameworkConfig.globalResources([
PLATFORM.moduleName('./form/au-json-schema-form'),
PLATFORM.moduleName('./value-converters/sf-number-value-converter'),
PLATFORM.moduleName('./value-converters/sf-array-can-remove-value-converter'),
PLATFORM.moduleName('./value-converters/sf-boolean-is-read-only-value-converter'),
PLATFORM.moduleName('./form/array/sf-array'),
PLATFORM.moduleName('./form/object/sf-object'),
PLATFORM.moduleName('./form/number/sf-number'),
PLATFORM.moduleName('./form/text/sf-string'),
PLATFORM.moduleName('./form/boolean/sf-boolean'),
PLATFORM.moduleName('./templates/bootstrap4/bootstrap-tooltip')
]);
}
示例3: patchViewResources
export function patchViewResources(viewResources: ViewResources) {
const logger = LogManager.getLogger('templating');
/**
* from: https://github.com/aurelia/templating/blob/master/src/view-engine.js
*/
ViewEngine.prototype.loadTemplateResources = function loadTemplateResources(registryEntry, compileInstruction, loadContext) {
var resources = new ViewResources(this.appResources, registryEntry.address);
// START PATCH
// TODO: this should be done in a monkey-patched constructor of ViewResources
if (!resources.lookupFunctions.bindingFunctions) Object.assign(resources.lookupFunctions, { bindingFunctions: resources.getBindingFunction.bind(resources) })
if (!resources.bindingFunctions) resources.bindingFunctions = {}
// END PATCH
var dependencies = registryEntry.dependencies;
var importIds = void 0;
var names = void 0;
compileInstruction = compileInstruction || ViewCompileInstruction.normal;
if (dependencies.length === 0 && !compileInstruction.associatedModuleId) {
return Promise.resolve(resources);
}
importIds = dependencies.map(function (x) {
return x.src;
});
names = dependencies.map(function (x) {
return x.name;
});
logger.debug('importing resources for ' + registryEntry.address, importIds);
return this.importViewResources(importIds, names, resources, compileInstruction, loadContext);
};
/**
* Registers a binding behavior.
* @param name The name of the binding function.
* @param bindingBehavior The binding function instance.
*/
ViewResources.prototype.registerBindingFunction = function(name: string, bindingFunction: Object): void {
register(this.bindingFunctions, name, bindingFunction, 'a BindingFunction')
}
/**
* Gets a binding behavior.
* @param name The name of the binding function.
* @return The binding function instance.
*/
ViewResources.prototype.getBindingFunction = function(name: string): Object {
return this.bindingFunctions[name] || (this.hasParent ? this.parent.getBindingFunction(name) : null)
}
// patch global instance of ViewResources
viewResources.bindingFunctions = {}
Object.assign(viewResources.lookupFunctions, { bindingFunctions: viewResources.getBindingFunction.bind(viewResources) })
}
示例4: sanitize
/**
* Sanitizes the provided input.
* @param input The input to be sanitized.
*/
sanitize(input) {
if (needsToWarn) {
needsToWarn = false;
getLogger('html-sanitizer')
.warn(`CAUTION: The default HTMLSanitizer does NOT provide security against a wide variety of sophisticated XSS attacks,
and should not be relied on for sanitizing input from unknown sources.
Please see https://aurelia.io/docs/binding/basics#element-content for instructions on how to use a secure solution like DOMPurify or sanitize-html.`);
}
return input.replace(SCRIPT_REGEX, '');
}
示例5: setFormOverrides
export function setFormOverrides(
form: IFormOverride, parentSchema: IJsonSchemaDefinition, formKey: string, schema: IJsonSchemaDefinition
) {
getLogger('aurelia-json-schema-form')
.info('setFormOverrides', { form, parentSchema, formKey, schema });
schema.title = schema.title || (!!formKey ? fromCamelCase(formKey) : undefined);
form.$schema = schema;
if (form.$enum) {
form.$schema.enum = Array.from(form.$enum.values());
}
if (parentSchema && parentSchema.type === 'object') {
form.$required = form.$required || (parentSchema.required
? (parentSchema as IJsonSchemaObjectDefinition).required.indexOf(formKey) > -1 : false);
}
}
示例6: _createDynamicElement
export function _createDynamicElement({ name, viewUrl, bindableNames, useShadowDOMmode }: {
name: string,
viewUrl: string,
bindableNames: string[],
useShadowDOMmode: null | '' | 'open' | 'closed'
}): Function {
@customElement(name)
@useView(viewUrl)
class DynamicElement {
$parent: any;
bind(bindingContext) {
this.$parent = bindingContext;
}
}
for (let i = 0, ii = bindableNames.length; i < ii; ++i) {
bindable(bindableNames[i])(DynamicElement);
}
switch (useShadowDOMmode) {
case 'open':
useShadowDOM({ mode: 'open' })(DynamicElement);
break;
case 'closed':
useShadowDOM({ mode: 'closed' })(DynamicElement);
break;
case '':
useShadowDOM(DynamicElement);
break;
case null:
// Do not use shadow dom
break;
default:
getLogger('aurelia-html-only-element')
.warn(`Expected 'use-shadow-dom' value to be "close", "open" or "", received ${useShadowDOMmode}`);
break;
}
return DynamicElement;
}
示例7: constructor
constructor(settings: core.Settings) {
this._logger = LogManager.getLogger(settings.app.prefix);
}
示例8: require
import { join } from 'path'
import { existsSync } from 'fs'
import ava from 'ava'
import bluebird = require('bluebird')
import { getLogger } from 'aurelia-logging'
import fixture from './index'
const cwd = process.cwd()
const logger = getLogger('fixture.spec')
logger.debug('starting fixture.spec')
const ftest = fixture(ava, join(process.env['PWD']!, 'fixtures/cases'))
ava('shape test', t => {
t.truthy(ftest.failing)
t.truthy(ftest.failing.only)
t.truthy(ftest.failing.skip)
t.truthy(ftest.only)
t.truthy(ftest.only.failing)
t.truthy(ftest.skip)
t.truthy(ftest.skip.failing)
})
ftest('abs path', 'case-1', (t, d) => {
const localCwd = process.cwd()
logger.debug('abs path, case-1')
logger.debug(`outer cwd: ${cwd}`)
logger.debug(`local cwd: ${localCwd}`)
t.is(d.caseName, 'case-1')
示例9: getLogger
import Order from 'assert-order'
import { getLogger } from 'aurelia-logging'
import ava from 'ava'
import { readdirSync } from 'fs'
import { resolve, join } from 'path'
import fixture from './index'
const log = getLogger('fixture.each.spec')
log.debug('starting fixture.each.spec')
const parent = resolve(process.cwd(), 'fixtures/cases')
const dirs = readdirSync(parent).toString().split(',')
const ctest = fixture(ava, 'fixtures/cases')
log.debug('fixture.each.spec loaded dirs')
ava('baseline and result must be specified together', t => {
t.throws(() => (fixture as any)(ava, 'x', 'y'))
})
ava('shape', t => {
t.not(ctest.each, undefined)
t.not(ctest.each.failing, undefined)
t.not(ctest.only.each, undefined)
t.not(ctest.only.each.failing, undefined)
t.not(ctest.skip.each, undefined)
t.not(ctest.skip.each.failing, undefined)
})
const dirsCopy = [...dirs]
const order = new Order(dirs.length)
示例10: constructor
constructor(targetInstruction: any) {
this.log = getLogger('aurelia-tree-view/tree-node-template');
this.template = targetInstruction.elementInstruction.template;
// this.log.debug(targetInstruction);
}