mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2026-04-27 03:19:22 +00:00
23 lines
508 B
JavaScript
23 lines
508 B
JavaScript
/**
|
|
* Safe logger for Electron build/dev scripts. Uses console when available;
|
|
* no-ops if console is missing or throws (e.g. in some packaged contexts).
|
|
*/
|
|
const noop = () => {};
|
|
function bind(fn) {
|
|
try {
|
|
return typeof console !== 'undefined' && typeof console[fn] === 'function'
|
|
? console[fn].bind(console)
|
|
: noop;
|
|
} catch {
|
|
return noop;
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
log: bind('log'),
|
|
error: bind('error'),
|
|
warn: bind('warn'),
|
|
debug: bind('debug'),
|
|
info: bind('info'),
|
|
};
|