Skip to content

Commit

Permalink
fix: 修复console.log被drop之后报错的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed May 23, 2022
1 parent 62c1290 commit 74305a2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/fast-crud/src/utils/util.log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,27 @@ function getCallerInfo() {
const blank = (...args) => {};

const error = (...args) => {
if (!console.error) {
return;
}
console.error("[error]", ...args);
};
const warn = (...args) => {
if (!console.warn) {
return;
}
console.warn("[warn]", ...args);
};
const info = (...args) => {
if (!console.log) {
return;
}
console.log("[info]", ...args);
};
const debug = (...args) => {
if (!console.log) {
return;
}
const callerInfo = getCallerInfo();
if (DEBUG_WITH_CALLER) {
console.log("[debug]", ...args, "\n", callerInfo);
Expand Down

0 comments on commit 74305a2

Please sign in to comment.