Skip to content

Commit e6e9bd8

Browse files
committed
🔧chore(core): 调整日志输出
1 parent 5be989c commit e6e9bd8

1 file changed

Lines changed: 9 additions & 20 deletions

File tree

src/shared/index.ts

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,60 +18,49 @@ export const execCommand = async (
1818
return res?.stdout?.trim() || "";
1919
};
2020

21-
export class PrettyError extends Error {
22-
constructor(message: string) {
23-
super(message);
24-
this.name = this.constructor.name;
25-
26-
if (typeof Error.captureStackTrace === "function")
27-
Error.captureStackTrace(this, this.constructor);
28-
else this.stack = new Error(message).stack;
29-
}
30-
}
31-
3221
export function handleError(error: unknown) {
33-
if (error instanceof PrettyError) printError(error);
22+
error && printError(error);
3423
process.exitCode = 1;
3524
}
3625

3726
export const loggerInfo = (content: string) => {
3827
if (ACTIVATION) {
39-
console.log(green(`[CG INFO]:`), `${content}`);
28+
console.log(green(`[CODEG]:`), `${content}`);
4029
}
4130
};
4231

4332
export const loggerWarring = (content: string | unknown) => {
4433
if (ACTIVATION) {
45-
console.log(lightYellow(`[CG WARRING]:`), `${content}`);
34+
console.log(lightYellow(`[CODEG]:`), `${content}`);
4635
}
4736
};
4837

4938
export const loggerSuccess = (content: string) => {
5039
if (ACTIVATION) {
51-
console.log(lightGreen(`[CG SUCCESS]:`), `${content}`);
40+
console.log(lightGreen(`[CODEG]:`), `${content}`);
5241
}
5342
};
5443

5544
export const loggerError = (content: string | unknown) => {
5645
if (ACTIVATION) {
57-
console.log(lightRed(`[CG ERROR]:`), `${content}`);
46+
console.log(lightRed(`[CODEG]:`), `${content}`);
5847
}
5948
};
6049

6150
export const printInfo = (content: string) => {
62-
console.log(green(`[CG INFO]:`), `${content}`);
51+
console.log(green(`[CODEG]:`), `${content}`);
6352
};
6453

6554
export const printWarring = (content: string) => {
66-
console.log(lightYellow(`[CG WARRING]:`), `${content}`);
55+
console.log(lightYellow(`[CODEG]:`), `${content}`);
6756
};
6857

6958
export const printSuccess = (content: string) => {
70-
console.log(lightGreen(`[CG SUCCESS]:`), `${content}`);
59+
console.log(lightGreen(`[CODEG]:`), `${content}`);
7160
};
7261

7362
export const printError = (content: string | unknown) => {
74-
console.log(lightRed(`[CG ERROR]:`), `${content}`);
63+
console.log(lightRed(`[CODEG]:`), `${content}`);
7564
};
7665

7766
/**

0 commit comments

Comments
 (0)