Skip to content

Instantly share code, notes, and snippets.

@m4n1ok
Created February 18, 2020 09:37
Show Gist options
  • Save m4n1ok/bf8f3f4d1eac9a7ae74a4312ead7b33a to your computer and use it in GitHub Desktop.
Save m4n1ok/bf8f3f4d1eac9a7ae74a4312ead7b33a to your computer and use it in GitHub Desktop.
A simple wrapper around console.log / chalk / terminal-link to have nice log into node.js program
const chalk = require('chalk')
const terminalLink = require('terminal-link')
const log = console.log
module.exports = {
log,
chalk,
terminalLink,
success: (msg) => log(chalk.green(msg)),
warning: (msg) => log(chalk.yellow(`⚠️ ${msg}`)),
error: (msg) => log(chalk.red(`❌️ ${msg}`)),
separator: () => log(chalk.black('\n------------------------------------\n')),
underline: chalk.underline
}
@m4n1ok
Copy link
Author

m4n1ok commented Feb 18, 2020

Usage:

const logger = require('./logger')
const msg = 'Oh yeah'
logger.success(msg)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment