at-builder 1.4.5 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/bin/constants/config.js +1 -1
- package/bin/index.js +153 -66
- package/bin/services/telemetry.js +320 -0
- package/package.json +12 -1
- package/.vscode/settings.json +0 -6
- package/DEVELOPMENT.md +0 -164
- package/at-builder-0.0.2.vsix +0 -0
- package/src/constants/config.ts +0 -321
- package/src/index.ts +0 -387
- package/src/services/doctor.ts +0 -724
- package/src/services/logger.ts +0 -84
package/src/services/logger.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { getENV } from "../constants/config";
|
|
2
|
-
|
|
3
|
-
// Initialize verbose setting with a default value
|
|
4
|
-
let isVerbose = false;
|
|
5
|
-
|
|
6
|
-
// Set up verbose mode asynchronously
|
|
7
|
-
getENV(process.cwd())
|
|
8
|
-
.then(envVars => {
|
|
9
|
-
isVerbose = envVars.VERBOSE === 'true';
|
|
10
|
-
})
|
|
11
|
-
.catch(() => {
|
|
12
|
-
isVerbose = false;
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const logger = {
|
|
16
|
-
MAX_RECORDS: 2000,
|
|
17
|
-
get verbose() {
|
|
18
|
-
return isVerbose;
|
|
19
|
-
},
|
|
20
|
-
// "debug"
|
|
21
|
-
log: function (tag, msg, ...rest) {
|
|
22
|
-
this._log("l", msg, tag, rest);
|
|
23
|
-
},
|
|
24
|
-
// "info"
|
|
25
|
-
info: function (tag, msg, ...rest) {
|
|
26
|
-
this._log("i", msg, tag, rest);
|
|
27
|
-
},
|
|
28
|
-
// "warn"
|
|
29
|
-
warn: function (tag, msg, ...rest) {
|
|
30
|
-
this._log("w", msg, tag, rest);
|
|
31
|
-
},
|
|
32
|
-
// "error"
|
|
33
|
-
error: function (tag, msg, ...rest) {
|
|
34
|
-
this._log("e", msg, tag, rest);
|
|
35
|
-
},
|
|
36
|
-
_log: function (level, msg, tag, ...rest) {
|
|
37
|
-
const origMsg = msg;
|
|
38
|
-
if (rest.length) {
|
|
39
|
-
msg = msg + " " + rest.join("\n")
|
|
40
|
-
}
|
|
41
|
-
let record;
|
|
42
|
-
tag = tag || null;
|
|
43
|
-
record = (
|
|
44
|
-
(tag != null) ? "[" + tag + "] " + msg : msg
|
|
45
|
-
);
|
|
46
|
-
const time = (new Date).toLocaleDateString() + " " + (new Date).toLocaleTimeString();
|
|
47
|
-
record = time + " " + record;
|
|
48
|
-
|
|
49
|
-
if(logger.verbose) {
|
|
50
|
-
const colors = {
|
|
51
|
-
reset: "\x1b[0m",
|
|
52
|
-
bright: "\x1b[1m",
|
|
53
|
-
dim: "\x1b[2m",
|
|
54
|
-
time: "\x1b[36m", // cyan
|
|
55
|
-
tag: "\x1b[35m", // magenta
|
|
56
|
-
message: "\x1b[37m", // white
|
|
57
|
-
error: "\x1b[31m", // red
|
|
58
|
-
warn: "\x1b[33m", // yellow
|
|
59
|
-
info: "\x1b[32m", // green
|
|
60
|
-
debug: "\x1b[34m" // blue
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const coloredTime = `${colors.time}${time}${colors.reset}`;
|
|
64
|
-
const coloredTag = tag ? `${colors.tag}[${tag}]${colors.reset}` : '';
|
|
65
|
-
|
|
66
|
-
switch (level) {
|
|
67
|
-
case "l":
|
|
68
|
-
console.log(coloredTime, coloredTag, `${colors.debug}${origMsg}${colors.reset}`, rest.join(" "));
|
|
69
|
-
break;
|
|
70
|
-
case "i":
|
|
71
|
-
console.info(coloredTime, coloredTag, `${colors.info}${origMsg}${colors.reset}`, rest.join(" "));
|
|
72
|
-
break;
|
|
73
|
-
case "w":
|
|
74
|
-
console.warn(coloredTime, coloredTag, `${colors.warn}${origMsg}${colors.reset}`, rest.join(" "));
|
|
75
|
-
break;
|
|
76
|
-
case "e":
|
|
77
|
-
console.error(coloredTime, coloredTag, `${colors.error}${origMsg}${colors.reset}`, rest.join(" "));
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export default logger;
|