Ghost/ghost/pretty-cli/lib/ui.js
Hannah Wolfe a929b6a0f9 Added full suite of log functions
- matches logging in ignition: https://github.com/TryGhost/Ignition/blob/master/lib/logging/PrettyStream.js#L11
- so that it's possible to add log lines to our CLI tools that have a consistent format
2019-03-10 15:08:53 +00:00

33 lines
729 B
JavaScript

const chalk = require('chalk');
const log = (...args) => console.log(...args); // eslint-disable-line no-console
module.exports.log = log;
module.exports.log.ok = (...args) => {
log(chalk.green('ok'), ...args);
};
module.exports.log.trace = (...args) => {
log(chalk.gray('trace'), ...args);
};
module.exports.log.debug = (...args) => {
log(chalk.gray('debug'), ...args);
};
module.exports.log.info = (...args) => {
log(chalk.cyan('info'), ...args);
};
module.exports.log.warn = (...args) => {
log(chalk.magenta('ok'), ...args);
};
module.exports.log.error = (...args) => {
log(chalk.red('error'), ...args);
};
module.exports.log.fatal = (...args) => {
log(chalk.inverse('fatal'), ...args);
};