const asciiArt = require('ascii-art')

const INFO_COLOR = 'green'
const ERROR_COLOR = 'red'

/**
 * Logging
 * @param args
 */
const log = {
  plain: (...args) => {
    console.log.bind(console, ...args)()
  },
  info: (...args) => {
    args[0] = '\r' + args[0]
    args.unshift(asciiArt.style('', INFO_COLOR))
    args.push(asciiArt.style('', INFO_COLOR, true))
    console.log.bind(console, ...args)()
  },
  error: (...args) => {
    args[0] = '\r' + args[0]
    args.unshift(asciiArt.style('', ERROR_COLOR))
    args.push(asciiArt.style('', ERROR_COLOR, true))
    console.error.bind(console, ...args)()
  }
}

module.exports = log
