本文整理汇总了TypeScript中@angular-devkit/core.logging.Logger.createChild方法的典型用法代码示例。如果您正苦于以下问题:TypeScript logging.Logger.createChild方法的具体用法?TypeScript logging.Logger.createChild怎么用?TypeScript logging.Logger.createChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular-devkit/core.logging.Logger
的用法示例。
在下文中一共展示了logging.Logger.createChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onInput
function onInput(i: BuilderInput) {
const builder = i.info as BuilderInfo;
const loggerName = i.target
? targetStringFromTarget(i.target as Target)
: builder.builderName;
const logger = new logging.Logger(loggerName);
subscriptions.push(logger.subscribe(entry => log(entry)));
const context: BuilderContext = {
builder,
workspaceRoot: i.workspaceRoot,
currentDirectory: i.currentDirectory,
target: i.target as Target,
logger: logger,
id: i.id,
async scheduleTarget(
target: Target,
overrides: json.JsonObject = {},
scheduleOptions: ScheduleOptions = {},
) {
const run = await scheduleByTarget(target, overrides, {
scheduler,
logger: scheduleOptions.logger || logger.createChild(''),
workspaceRoot: i.workspaceRoot,
currentDirectory: i.currentDirectory,
});
// We don't want to subscribe errors and complete.
subscriptions.push(run.progress.subscribe(event => progressChannel.next(event)));
return run;
},
async scheduleBuilder(
builderName: string,
options: json.JsonObject = {},
scheduleOptions: ScheduleOptions = {},
) {
const run = await scheduleByName(builderName, options, {
scheduler,
logger: scheduleOptions.logger || logger.createChild(''),
workspaceRoot: i.workspaceRoot,
currentDirectory: i.currentDirectory,
});
// We don't want to subscribe errors and complete.
subscriptions.push(run.progress.subscribe(event => progressChannel.next(event)));
return run;
},
async getTargetOptions(target: Target) {
return scheduler.schedule<Target, json.JsonValue, json.JsonObject>(
'..getTargetOptions', target).output.toPromise();
},
async getBuilderNameForTarget(target: Target) {
return scheduler.schedule<Target, json.JsonValue, string>(
'..getBuilderNameForTarget',
target,
).output.toPromise();
},
async validateOptions<T extends json.JsonObject = json.JsonObject>(
options: json.JsonObject,
builderName: string,
) {
return scheduler.schedule<[string, json.JsonObject], json.JsonValue, T>(
'..validateOptions',
[builderName, options],
).output.toPromise();
},
reportRunning() {
switch (currentState) {
case BuilderProgressState.Waiting:
case BuilderProgressState.Stopped:
progress({ state: BuilderProgressState.Running, current: 0, total }, context);
break;
}
},
reportStatus(status: string) {
switch (currentState) {
case BuilderProgressState.Running:
progress({ state: currentState, status, current, total }, context);
break;
case BuilderProgressState.Waiting:
progress({ state: currentState, status }, context);
break;
}
},
reportProgress(current: number, total?: number, status?: string) {
switch (currentState) {
case BuilderProgressState.Running:
progress({ state: currentState, current, total, status }, context);
}
},
analytics: new analytics.ForwardingAnalytics(report => analyticsChannel.next(report)),
addTeardown(teardown: () => (Promise<void> | void)): void {
teardownLogics.push(teardown);
},
};
context.reportRunning();
//.........这里部分代码省略.........