bixi
Version:
企业级中后台前端解决方案
24 lines (18 loc) • 594 B
text/typescript
import { isDevMode } from '@angular/core';
import { NzSafeAny } from 'ng-zorro-antd/core/types';
const record: Record<string, boolean> = {};
function notRecorded(...args: NzSafeAny[]): boolean {
const asRecord = args.reduce((acc, c) => acc + c.toString(), '');
if (record[asRecord]) {
return false;
} else {
record[asRecord] = true;
return true;
}
}
export const log = (scope: string, ...args: NzSafeAny[]) => {
if (isDevMode() && notRecorded([scope, ...args])) {
const stack = new Error().stack;
console.warn(`[@bixi/core] ${scope}`, ...args, stack);
}
};