@putout/engine-runner
Version:
21 lines (17 loc) • 510 B
JavaScript
import * as obug from 'obug';
export const createDebug = (namespace) => {
const log = obug.createDebug(namespace, {
useColors: true,
});
return new Proxy(log, {
apply(target, thisArg, args) {
globalThis.__putout_debug?.(namespace, ...args);
return target(...args);
},
get(target, prop) {
if (globalThis.__putout_debug?.[prop])
return true;
return target[prop];
},
});
};