Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format the log content to keep the original chalk color tag and fix typo #13

Merged
merged 3 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ type logLevelType = (typeof levelNames)[number];
// The default level which controls the output. Each Logger could specify its own to replace this
// default is "info"
let defaultLevelValue = 1;
// Globally we could config the categories to show. It's the allowed categories substract all
// categories forbidden. Note empty categoriesAllowed below actaully means all are allowed
// Globally we could config the categories to show. It's the allowed categories subtract all
// categories forbidden. Note empty categoriesAllowed below actually means all are allowed

let categoriesAllowed: Dict<boolean> = {}; // empty actaully means all are allowed
let categoriesAllowed: Dict<boolean> = {}; // empty actually means all are allowed
let categoriesForbidden: Dict<boolean> = {}; // empty means none is forbidden

const formatters = {
Expand Down Expand Up @@ -290,7 +290,7 @@ const logger = {
},

/**
* Create a Logger. It's called get() for convention, but it's actaully mean create(). That means,
* Create a Logger. It's called get() for convention, but it's actually mean create(). That means,
* if you call it with the same category twice, it create two separated Logger for you, instead of
* a shared one.
* @param category this classifies the log and itself will show and highlight in console
Expand All @@ -304,7 +304,7 @@ const logger = {
/**
* Only allow some categories to show. Set it to [] means to clear this, i.e. allowing all to show
* @param cats Categories allowed to show, like a filter. [] means allowing all.
* @returns Old cateogories
* @returns Old categories
*/
onlyAllowCategories(cats: string[]): string[] {
const old = Array.from(Object.keys(categoriesAllowed));
Expand Down
3 changes: 2 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,8 @@ async function startServer() {
log.info("--> get build log");
try {
const data = matchedData(req);
const content = API.getBuildLog(data.root);
// eslint-disable-next-line no-control-regex
const content = API.getBuildLog(data.root).replace(/\u001b/g, "\\u001b");
res.status(200).json({ content });
} catch (e) {
log.error("get build log error\n", H.normalizeErrorOutput(e as Error));
Expand Down