Passed
Pull Request — master (#30)
by
unknown
27:43 queued 20:14
created

libs/src/compiler/consoler.ts   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 31
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 1
mnd 1
bc 1
fnc 0
bpm 0
cpm 0
noi 0
1
/**
2
 * Consoler
3
 */
4
[
5
  ["warn", "\x1b[35m"],
6
  ["error", "\x1b[31m"],
7
  ["log", "\x1b[2m"],
8
].forEach(function (pair) {
9
  var method = pair[0],
10
    reset = "\x1b[0m",
11
    color = "\x1b[36m" + pair[1];
12
  console[method] = console[method].bind(
13
    console,
14
    color,
15
    `${method.toUpperCase()} [${new Date().getHours()}:${new Date().getMinutes()}:${new Date().getSeconds()}]`,
16
    reset
17
  );
18
});
19
20
console.error = (function () {
21
  var error = console.error;
22
23
  return function (exception: { stack: any }) {
24
    if (typeof exception.stack !== "undefined") {
25
      error.call(console, exception.stack);
26
    } else {
27
      error.apply(console, arguments);
28
    }
29
  };
30
})();
31