Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
log._format = function (msg, style) {
if (!stream) return
var output = ''
if (this.useColor()) {
style = style || {}
var settings = []
if (style.fg) settings.push(style.fg)
if (style.bg) settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1))
if (style.bold) settings.push('bold')
if (style.underline) settings.push('underline')
if (style.inverse) settings.push('inverse')
if (settings.length) output += consoleControl.color(settings)
if (style.beep) output += consoleControl.beep()
}
output += msg
if (this.useColor()) {
output += consoleControl.color('reset')
}
return output
}
function color (value, colorName, withColor) {
return (colorName && withColor) ? ccs.color(colorName) + value + ccs.color('reset') : value
}
var output = ''
if (this.useColor()) {
style = style || {}
var settings = []
if (style.fg) settings.push(style.fg)
if (style.bg) settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1))
if (style.bold) settings.push('bold')
if (style.underline) settings.push('underline')
if (style.inverse) settings.push('inverse')
if (settings.length) output += consoleControl.color(settings)
if (style.beep) output += consoleControl.beep()
}
output += msg
if (this.useColor()) {
output += consoleControl.color('reset')
}
return output
}
themes.addTheme('ASCII', {
preProgressbar: '[',
postProgressbar: ']',
progressbarTheme: {
complete: '#',
remaining: '.'
},
activityIndicatorTheme: '-\\|/',
preSubsection: '>'
})
themes.addTheme('colorASCII', themes.getTheme('ASCII'), {
progressbarTheme: {
preComplete: consoleControl.color('inverse'),
complete: ' ',
postComplete: consoleControl.color('stopInverse'),
preRemaining: consoleControl.color('brightBlack'),
remaining: '.',
postRemaining: consoleControl.color('reset')
}
})
themes.addTheme('brailleSpinner', {
preProgressbar: '⸨',
postProgressbar: '⸩',
progressbarTheme: {
complete: '░',
remaining: '⠂'
},
activityIndicatorTheme: '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏',
preSubsection: '>'
})
var themes = module.exports = new ThemeSet()
themes.addTheme('ASCII', {
preProgressbar: '[',
postProgressbar: ']',
progressbarTheme: {
complete: '#',
remaining: '.'
},
activityIndicatorTheme: '-\\|/',
preSubsection: '>'
})
themes.addTheme('colorASCII', themes.getTheme('ASCII'), {
progressbarTheme: {
preComplete: consoleControl.color('inverse'),
complete: ' ',
postComplete: consoleControl.color('stopInverse'),
preRemaining: consoleControl.color('brightBlack'),
remaining: '.',
postRemaining: consoleControl.color('reset')
}
})
themes.addTheme('brailleSpinner', {
preProgressbar: '⸨',
postProgressbar: '⸩',
progressbarTheme: {
complete: '░',
remaining: '⠂'
},
activityIndicatorTheme: '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏',
})
themes.addTheme('brailleSpinner', {
preProgressbar: '⸨',
postProgressbar: '⸩',
progressbarTheme: {
complete: '#',
remaining: '⠂'
},
activityIndicatorTheme: '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏',
preSubsection: '>'
})
themes.addTheme('colorBrailleSpinner', themes.getTheme('brailleSpinner'), {
progressbarTheme: {
preComplete: color('bgBrightWhite', 'brightWhite'),
complete: '#',
postComplete: color('reset'),
preRemaining: color('bgBrightBlack', 'brightBlack'),
remaining: '⠂',
postRemaining: color('reset')
}
})
themes.setDefault({}, 'ASCII')
themes.setDefault({hasColor: true}, 'colorASCII')
themes.setDefault({platform: 'darwin', hasUnicode: true}, 'brailleSpinner')
themes.setDefault({platform: 'darwin', hasUnicode: true, hasColor: true}, 'colorBrailleSpinner')
log._format = function (msg, style) {
if (!stream) return
var output = ''
if (this.useColor()) {
style = style || {}
var settings = []
if (style.fg) settings.push(style.fg)
if (style.bg) settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1))
if (style.bold) settings.push('bold')
if (style.underline) settings.push('underline')
if (style.inverse) settings.push('inverse')
if (settings.length) output += consoleControl.color(settings)
if (style.beep) output += consoleControl.beep()
}
output += msg
if (this.useColor()) {
output += consoleControl.color('reset')
}
return output
}
preProgressbar: '[',
postProgressbar: ']',
progressbarTheme: {
complete: '#',
remaining: '.'
},
activityIndicatorTheme: '-\\|/',
preSubsection: '>'
})
themes.addTheme('colorASCII', themes.getTheme('ASCII'), {
progressbarTheme: {
preComplete: color('bgBrightWhite', 'brightWhite'),
complete: '#',
postComplete: color('reset'),
preRemaining: color('bgBrightBlack', 'brightBlack'),
remaining: '.',
postRemaining: color('reset')
}
})
themes.addTheme('brailleSpinner', {
preProgressbar: '⸨',
postProgressbar: '⸩',
progressbarTheme: {
complete: '#',
remaining: '⠂'
},
activityIndicatorTheme: '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏',
preSubsection: '>'
})
log._format = function (msg, style) {
if (!stream) return
var output = ''
if (this.useColor()) {
style = style || {}
var settings = []
if (style.fg) settings.push(style.fg)
if (style.bg) settings.push('bg' + style.bg[0].toUpperCase() + style.bg.slice(1))
if (style.bold) settings.push('bold')
if (style.underline) settings.push('underline')
if (style.inverse) settings.push('inverse')
if (settings.length) output += consoleControl.color(settings)
if (style.beep) output += consoleControl.beep()
}
output += msg
if (this.useColor()) {
output += consoleControl.color('reset')
}
return output
}