refactor consoleHelper
This commit is contained in:
parent
2485638760
commit
8dc931eede
2 changed files with 11 additions and 6 deletions
|
@ -2,28 +2,28 @@ const chalk = require("chalk");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
printWebReq:function(s) {
|
printWebReq:function(s) {
|
||||||
console.log(`${chalk.green("["+this.getTime()+"]")} ${chalk.bgGreen((" WEBREQ "))} ${s}`);
|
console.log(`${this.getTime()} ${chalk.bgGreen(chalk.black(" WEBREQ "))} ${s}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
printBancho:function(s) {
|
printBancho:function(s) {
|
||||||
console.log(`${chalk.green("["+this.getTime()+"]")} ${chalk.bgMagenta((" BANCHO "))} ${s}`);
|
console.log(`${this.getTime()} ${chalk.bgMagenta(chalk.black(" BANCHO "))} ${s}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
printChat:function(s) {
|
printChat:function(s) {
|
||||||
console.log(`${chalk.green("["+this.getTime()+"]")} ${chalk.bgCyan((" CHAT "))} ${s}`);
|
console.log(`${this.getTime()} ${chalk.bgCyan(chalk.black(" CHATTO "))} ${s}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
printWarn:function(s) {
|
printWarn:function(s) {
|
||||||
console.warn(`${chalk.green("["+this.getTime()+"]")} ${chalk.bgYellow((" WARN "))} ${chalk.yellow(s)}`);
|
console.warn(`${this.getTime()} ${chalk.bgYellow(chalk.black(" WARNIN "))} ${chalk.yellow(s)}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
printError:function(s) {
|
printError:function(s) {
|
||||||
console.error(`${chalk.green("["+this.getTime()+"]")} ${chalk.bgRed((" ERROR "))} ${chalk.red(s)}`);
|
console.error(`${this.getTime()} ${chalk.bgRed((" ERROR! "))} ${chalk.red(s)}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
getTime:function() {
|
getTime:function() {
|
||||||
const time = new Date();
|
const time = new Date();
|
||||||
return `${correctValue(time.getHours())}:${correctValue(time.getMinutes())}:${correctValue(time.getSeconds())}`;
|
return chalk.green(`[${correctValue(time.getHours())}:${correctValue(time.getMinutes())}:${correctValue(time.getSeconds())}]`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
server/util/shortUUID.js
Normal file
5
server/util/shortUUID.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
const uuid = require("uuid").v4;
|
||||||
|
|
||||||
|
module.exports = function() {
|
||||||
|
return uuid().split("-").slice(0, 2).join("");
|
||||||
|
}
|
Loading…
Reference in a new issue