Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createConsola () {
// Log level
let level = env.debug ? 4 : 3
if (process.env.CONSOLA_LEVEL) {
level = parseInt(process.env.CONSOLA_LEVEL) || level
}
// Create new consola instance
const consola = new Consola({
level,
reporters: [
(env.ci || env.test)
? new BasicReporter()
: new FancyReporter()
]
})
// Expose constructors
consola.Consola = Consola
import chalk from 'chalk'
import messaging from './messaging'
import { ClusterReporter } from './reporters'
let _consola
if (global.__consolaSet === undefined) {
_consola = global.consola
// Delete the global.consola set by consola self
delete global.consola
}
let consola = global.consola // eslint-disable-line import/no-mutable-exports
if (!consola) {
consola = _consola.create({
level: env.debug ? 5 : 3,
types: {
..._consola._types,
...{
cluster: {
level: 4,
color: 'blue',
icon: chalk.magenta(figures.radioOn)
},
master: {
level: 2,
color: 'blue',
icon: chalk.cyan(figures.info)
},
debug: {
level: 5,
color: 'grey'