keys.forEach((key) => { let value = _OPTIONS[key]; if (typeof value == 'string') { if (key != 'base') value = reducePathname(value); value = colors.italic(`"${value}"`); } else if (typeof value == 'boolean') { value = colors.italic.green(value); } else if (value instanceof Array) { let rows = []; value.forEach((item) => { rows.push(colors.italic(`"${value}"`)); }); value = rows.join(os.EOL); } else if (typeof value == 'function') { value = 'Function() [ ... ]'; } else if (typeof value == 'object') { for (let subkey in value) { let subvalue = reducePathname(value[subkey]); rows.push({ name: key + '.' + subkey, value: `"${colors.italic(subvalue)}"` }); } return; } rows.push({ name: key, value: value }); });
Reporter.prototype.log = function (stats) { var output = new Table({ head: [colors.red.bold('Uptime'), colors.red.bold('User(m/s)'), colors.red.bold('Msg (c/u)')], colWidths: [20, 20, 20], colAligns: ['middle', 'middle', 'middle'] }), msg = (stats.connectionMsg + stats.updateMsg); output.push([ stats.time, stats.maxConnected + colors.italic(' (' + stats.usersPerSecond + ')'), msg + colors.italic(' (' + stats.connectionMsg + '|' + stats.updateMsg + ')') ]); console.log(output.toString()); };
function log (env, type, mesg) { if (env == 'n') { env = 'NET'; } else if (env == 'w') { env = 'WEB'; } else { env = 'SERVER'; } if (type == 's') { type = colors.green('success:'); } else if (type == 'i') { type = colors.cyan('info:'); } else if (type == 'w') { type = colors.yellow('warning:'); } else if (type == 'e') { type = colors.red('error:'); } else if (type == 'd') { type = colors.grey('debug:'); } if (typeof mesg == 'object') { mesg = colors.italic(colors.grey(JSON.stringify(mesg))); } console.log(' '+'['+colors.bold(colors.white(env))+'] '+colors.bold(type)+' '+mesg); } // log
value.forEach((item) => { rows.push(colors.italic(`"${value}"`)); });
var saved = require('./saved.json'); var colors = require('colors'); console.log("Your Quote Library:".bold); for (var index in saved) { var element = saved[index]; console.log(`\n${colors.magenta(element.quote)}\n--${colors.italic(element.author)}\n`) }; //TO DO: ADD CATEGORIES (i.e. funny, politics, deep, etc.)