-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLogger.ts
More file actions
29 lines (26 loc) · 892 Bytes
/
Copy pathLogger.ts
File metadata and controls
29 lines (26 loc) · 892 Bytes
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
/* tslint:disable no-console*/
import {inspect} from "util";
/**
* Pretty print the provided content to the screen. Uses util.inspect to do deeper printing
* than just a simple console.log.
*/
export function log(content: any) {
//Clear the console window before we display the results of the operation. Makes the output a bit
//more readable when running multiple commands in a row.
console.log("\x1Bc");
if (typeof content === "string") {
console.log(content);
} else {
console.log(inspect(content, {depth: 5, colors: true}));
}
console.log("\n");
}
/**
* Same as above just include a leading message before the printed data.
*/
export function logWithMessage(message: string, content: any) {
console.log("\x1Bc");
console.log(`${message}\n`);
console.log(inspect(content, {depth: 5, colors: true}));
console.log("\n");
}