本文整理匯總了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'))