Skip to content

Commit 10f2c56

Browse files
committed
refactor: move cli-logger to node and rename the factory function
1 parent 9ccc8cf commit 10f2c56

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed

packages/angular_devkit/core/node/cli-logger.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,34 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8+
import { IndentLogger, LogEntry, Logger, terminal } from '@angular-devkit/core';
89
import 'rxjs/add/operator/filter';
9-
import { bold, dim, red, white, yellow } from '../terminal';
10-
import { IndentLogger } from './indent';
11-
import { LogEntry, Logger } from './logger';
1210

1311

1412
/**
1513
* A Logger that sends information to STDOUT and STDERR.
1614
*/
17-
export function createLogger(verbose = false): Logger {
15+
export function createConsoleLogger(verbose = false): Logger {
1816
const logger = new IndentLogger('cling');
1917

2018
logger
2119
.filter((entry: LogEntry) => (entry.level != 'debug' || verbose))
2220
.subscribe((entry: LogEntry) => {
23-
let color: (s: string) => string = x => dim(white(x));
21+
let color: (s: string) => string = x => terminal.dim(terminal.white(x));
2422
let output = process.stdout;
2523
switch (entry.level) {
2624
case 'info':
27-
color = white;
25+
color = terminal.white;
2826
break;
2927
case 'warn':
30-
color = yellow;
28+
color = terminal.yellow;
3129
break;
3230
case 'error':
33-
color = red;
31+
color = terminal.red;
3432
output = process.stderr;
3533
break;
3634
case 'fatal':
37-
color = (x: string) => bold(red(x));
35+
color = (x: string) => terminal.bold(terminal.red(x));
3836
output = process.stderr;
3937
break;
4038
}

packages/angular_devkit/core/node/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
98
import * as fs from './fs';
9+
10+
export * from './cli-logger';
1011
export * from './resolve';
1112

1213
export { fs };

packages/angular_devkit/core/src/logger/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
export * from './cli-logger';
98
export * from './indent';
109
export * from './logger';
1110
export * from './null-logger';

packages/angular_devkit/schematics/bin/schematics.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
* Use of this source code is governed by an MIT-style license that can be
77
* found in the LICENSE file at https://angular.io/license
88
*/
9-
import { createLogger, schema, tags, terminal } from '@angular-devkit/core';
9+
import { schema, tags, terminal } from '@angular-devkit/core';
10+
import { createConsoleLogger } from '@angular-devkit/core/node';
1011
import {
1112
DryRunEvent,
1213
DryRunSink,
@@ -100,7 +101,7 @@ const argv = minimist(process.argv.slice(2), {
100101
});
101102

102103
/** Create the DevKit Logger used through the CLI. */
103-
const logger = createLogger(argv['verbose']);
104+
const logger = createConsoleLogger(argv['verbose']);
104105

105106
if (argv.help) {
106107
usage();

0 commit comments

Comments
 (0)