Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const symbol = ['error', 'warn'].includes(level) ? symbols.whoops : symbols.ok;
return chalk[color](`${symbol} wps: `);
},
template: '{{level}}'
};
/* istanbul ignore if */
if (options.timestamp) {
prefix.template = `[{{time}}] ${prefix.template}`;
}
/* eslint-disable no-param-reassign */
options.prefix = prefix;
options.name = 'webpack-plugin-serve';
const log = loglevel.create(options);
return log;
};
const color = colors[level];
const symbol = ['error', 'warn'].includes(level) ? symbols.whoops : symbols.ok;
return chalk[color](`${symbol} ${logName}: `);
},
template: '{{level}}'
};
if (options.timestamp) {
prefix.template = `[{{time}}] ${prefix.template}`;
}
/* eslint-disable no-param-reassign */
options.prefix = prefix;
options.name = logName;
const log = loglevel.create(options);
return log;
};
constructor(options) {
const opts = Object.assign({}, defaults, options);
const template = `${opts.timestamp ? '[{{time}}] ' : ''}{{level}}`;
const prefix = {
level: ({ level }) => {
const color = colors[level];
return chalk[color](opts.prefix);
},
template,
time: () => new Date().toTimeString().split(' ')[0]
};
const log = loglevel.create({ level: opts.level, name: 'apollo-log', prefix });
this.log = {
info: (args) => {
const mutated = opts.mutate(...['info'].concat(args));
log.info(mutated || args);
},
debug: (args) => {
const mutated = opts.mutate(...['debug'].concat(args));
log.debug(mutated || args);
}
};
this.options = opts;
}
level: ({ level }) => {
const color = colors[level];
const symbol = ['error', 'warn'].includes(level) ? symbols.whoops : symbols.ok;
return chalk[color](`${symbol} ${options.name}: `);
},
template: '{{level}}'
};
if (options.timestamp) {
prefix.template = `[{{time}}] ${prefix.template}`;
}
options.id = options.name + (options.unique ? nanoid() : '');
options.prefix = prefix;
const log = loglevel.create(options);
return log;
};