This repository has been archived on 2025-03-10. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
layc/src/Utils/Logger.js
2024-03-27 16:54:17 +00:00

16 lines
362 B
JavaScript

const LOGGING_TYPES = ['log', 'debug', 'error', 'warn', 'info'];
function Logger (data, type = 'debug') {
if(!process.env.DEBUG) return;
if(LOGGING_TYPES.indexOf(type) < 0) type = 'log';
console[type](...(Array.isArray(data) ? data : [data]));
}
for(const k of LOGGING_TYPES) {
Logger[k] = function() {
Logger(arguments, k);
}
}
export default Logger;