* add write-hca.js * refactor: Move config serializer into the uhk-common package * refactor: Move getTransferBuffers into the uhk-usb package * refactor: delete obsoleted classes * build: add uhk-usb build command * refactor: move eeprom transfer to uhk-usb package * fix: Fix write-hca.js * feat: load hardware config from the device and * style: fix ts lint errors * build: fix rxjs dependency resolve * test: Add jasmine unit test framework to the tet serializer * fix(user-config): A "type": "basic", properties to the "keystroke" action types * feat(usb): set chmod+x on write-hca.js * feat(usb): Create USB logger * style: Fix type * build: Add chalk to dependencies. Chalk will colorize the output
35 lines
827 B
JavaScript
35 lines
827 B
JavaScript
const {LogService, LogRegExps} = require('uhk-common');
|
|
const chalk = require('chalk');
|
|
|
|
class Logger extends LogService {
|
|
error(...args) {
|
|
console.error(args);
|
|
}
|
|
|
|
debug(...args) {
|
|
const msg = args.join(' ');
|
|
|
|
if (LogRegExps.writeRegExp.test(msg)) {
|
|
console.log(chalk.blue(msg));
|
|
} else if (LogRegExps.readRegExp.test(msg)) {
|
|
console.log(chalk.green(msg));
|
|
} else if (LogRegExps.errorRegExp.test(msg)) {
|
|
console.log(chalk.red(msg));
|
|
}else if (LogRegExps.transferRegExp.test(msg)) {
|
|
console.log(chalk.yellow(msg));
|
|
} else {
|
|
console.log(...args);
|
|
}
|
|
}
|
|
|
|
silly(...args) {
|
|
console.log(args);
|
|
}
|
|
|
|
info(...args) {
|
|
console.info(args);
|
|
}
|
|
}
|
|
|
|
module.exports = Logger;
|