chore: remove semi

This commit is contained in:
Katie Thornhill 2019-11-19 23:06:33 -05:00
parent 4b75eaa0ab
commit 8fcc0dcbf9
No known key found for this signature in database
GPG key ID: F76EDC6541A99644
64 changed files with 1073 additions and 1073 deletions

View file

@ -1,4 +1,4 @@
const chalk = require('chalk');
const chalk = require('chalk')
// const { debug } = require('yargs').argv
// process.env.DEBUG = process.env.DEBUG || debug
// logger template//
@ -6,54 +6,54 @@ const chalk = require('chalk');
class Logger {
constructor(name, debugOverride = false) {
this.name = name;
this.name = name
this.debugOn =
process.env.DEBUG === 'true' || process.env.DEBUG === '*' || debugOverride;
process.env.DEBUG === 'true' || process.env.DEBUG === '*' || debugOverride
}
fatal(text, ...data) {
this.error(text, data);
this.error(text, data)
if (typeof data[data.length - 1] === 'number') {
process.exit(data[data.length - 1]);
process.exit(data[data.length - 1])
} else {
process.exit(1);
process.exit(1)
}
throw text;
throw text
}
error(text, ...data) {
console.error(chalk.red.bold(`ERR ${this.name}:`) + `\n ${text}`, data);
console.error(chalk.red.bold(`ERR ${this.name}:`) + `\n ${text}`, data)
}
warn(text, ...data) {
console.warn(chalk.yellow.bold(`WARN ${this.name}:`) + `\n ${text}`, data);
console.warn(chalk.yellow.bold(`WARN ${this.name}:`) + `\n ${text}`, data)
}
notice(text, ...data) {
console.log(chalk.cyan.bold(`NOTICE ${this.name}:`) + `\n ${text}`, data);
console.log(chalk.cyan.bold(`NOTICE ${this.name}:`) + `\n ${text}`, data)
}
info(text, ...data) {
console.info(chalk.blue.bold(`INFO ${this.name}:`) + `\n ${text}`, data);
console.info(chalk.blue.bold(`INFO ${this.name}:`) + `\n ${text}`, data)
}
request(text, ...data) {
console.info(chalk.green.bold(`HTTP ${this.name}:`) + `\n ${text}`);
console.info(chalk.green.bold(`HTTP ${this.name}:`) + `\n ${text}`)
}
debug(text, ...data) {
if (this.debugOn) {
console.log(chalk.gray.bold(`DEBUG ${this.name}:`) + `\n ${text}`, data);
console.log(chalk.gray.bold(`DEBUG ${this.name}:`) + `\n ${text}`, data)
}
}
sql(logger, ...data) {
if (logger.debugOn) {
console.log(chalk.bold('DEBUG SQL:\n '), data);
console.log(chalk.bold('DEBUG SQL:\n '), data)
}
}
}
module.exports = Logger;
module.exports = Logger