本文整理汇总了TypeScript中@angular-devkit/core.logging.IndentLogger.pipe方法的典型用法代码示例。如果您正苦于以下问题:TypeScript logging.IndentLogger.pipe方法的具体用法?TypeScript logging.IndentLogger.pipe怎么用?TypeScript logging.IndentLogger.pipe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular-devkit/core.logging.IndentLogger
的用法示例。
在下文中一共展示了logging.IndentLogger.pipe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: minimist
import { logging } from '@angular-devkit/core';
import chalk from 'chalk';
import * as minimist from 'minimist';
import {filter} from 'rxjs/operators';
const { bold, red, yellow, white } = chalk;
const argv = minimist(process.argv.slice(2), {
boolean: ['verbose']
});
const rootLogger = new logging.IndentLogger('cling');
rootLogger
.pipe(filter(entry => (entry.level != 'debug' || argv['verbose'])))
.subscribe(entry => {
let color: (s: string) => string = white;
let output = process.stdout;
switch (entry.level) {
case 'info': color = white; break;
case 'warn': color = yellow; break;
case 'error': color = red; output = process.stderr; break;
case 'fatal': color = (x: string) => bold(red(x)); output = process.stderr; break;
}
output.write(color(entry.message) + '\n');
});
rootLogger
.pipe(filter(entry => entry.level == 'fatal'))