forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoggingUtilities.ts
More file actions
46 lines (40 loc) · 1.2 KB
/
LoggingUtilities.ts
File metadata and controls
46 lines (40 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import {
Terminal,
ITerminalProvider
} from '@microsoft/node-core-library';
import {
WriteFileIssueFunction,
IRushStackCompilerBaseOptions
} from './RushStackCompilerBase';
export class LoggingUtilities {
private _terminal: Terminal;
public constructor(terminal: ITerminalProvider) {
this._terminal = new Terminal(terminal);
}
public getDefaultRushStackCompilerBaseOptions(): IRushStackCompilerBaseOptions {
return {
fileError: this.fileError,
fileWarning: this.fileWarning
};
}
public fileError: WriteFileIssueFunction = (
filePath: string,
line: number,
column: number,
errorCode: string,
message: string
): void => {
this._terminal.writeErrorLine(`${filePath}(${line},${column}): error ${errorCode}: ${message}`);
}
public fileWarning: WriteFileIssueFunction = (
filePath: string,
line: number,
column: number,
errorCode: string,
message: string
): void => {
this._terminal.writeWarningLine(`${filePath}(${line},${column}): warning ${errorCode}: ${message}`);
}
}