1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.IndentLogger = void 0;
|
11 | const operators_1 = require("rxjs/operators");
|
12 | const logger_1 = require("./logger");
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | const indentationMap = {};
|
21 | class IndentLogger extends logger_1.Logger {
|
22 | constructor(name, parent = null, indentation = ' ') {
|
23 | super(name, parent);
|
24 | indentationMap[indentation] = indentationMap[indentation] || [''];
|
25 | const indentMap = indentationMap[indentation];
|
26 | this._observable = this._observable.pipe(operators_1.map((entry) => {
|
27 | const l = entry.path.filter((x) => !!x).length;
|
28 | if (l >= indentMap.length) {
|
29 | let current = indentMap[indentMap.length - 1];
|
30 | while (l >= indentMap.length) {
|
31 | current += indentation;
|
32 | indentMap.push(current);
|
33 | }
|
34 | }
|
35 | entry.message = indentMap[l] + entry.message.split(/\n/).join('\n' + indentMap[l]);
|
36 | return entry;
|
37 | }));
|
38 | }
|
39 | }
|
40 | exports.IndentLogger = IndentLogger;
|