parent
d469ed3969
commit
31d5741707
@ -1,14 +1,18 @@ |
|||||||
const logger = require('./src/util/log/log'); |
const logger = require('./src/util/log/log'); |
||||||
const client = {test: 'e', config: {logLevel: 1}}; |
const client = {test: 'e', config: {logLevel: 1}}; |
||||||
const log = logger(client); |
const loggers = logger(client); |
||||||
|
const log = loggers.log; |
||||||
log(); |
log(); |
||||||
log("Hello World!") |
log("Hello World!") |
||||||
log("Hello in blue", {color: 'blue'}); |
log("Hello in blue", {color: 'blue'}); |
||||||
log('A strange warning appears!', {color: 'yellowBright', source: 'warn', sourceColor: 'yellow'}); |
log('A strange warning appears!', {color: 'yellowBright', source: 'warn', sourceColor: 'yellow'}); |
||||||
log('Extra line spacing before', {}, false, true); |
/*log('Extra line spacing before', {}, false, true); |
||||||
log('regular line'); |
log('regular line'); |
||||||
log('extra line spacing after', {}, true); |
log('extra line spacing after', {}, true); |
||||||
log('regular line'); |
log('regular line'); |
||||||
log('both line spaces', {}, true, true); |
log('both line spaces', {}, true, true); |
||||||
log('regular line'); |
log('regular line'); |
||||||
log('a custom fancy pink color', {color: '#ff00ff', sourceColor: '#660066'}); |
log('a custom fancy pink color', {color: '#ff00ff', sourceColor: '#660066'});*/ |
||||||
|
loggers.warn("A warning appears!"); |
||||||
|
loggers.error("Something bad happened!"); |
||||||
|
loggers.success("Something good happened!"); |
@ -0,0 +1,20 @@ |
|||||||
|
module.exports = (log) => { return { |
||||||
|
error: (message, options, newLine, spacer) => log(message, { |
||||||
|
color: 'redBright', |
||||||
|
source: 'err!', |
||||||
|
sourceColor: 'red', |
||||||
|
level: 0 |
||||||
|
}, newLine, spacer), |
||||||
|
warn: (message, options, newLine, spacer) => log(message, { |
||||||
|
color: 'yellowBright', |
||||||
|
source: 'warn', |
||||||
|
sourceColor: 'yellow', |
||||||
|
level: 1 |
||||||
|
}, newLine, spacer), |
||||||
|
success: (message, options, newLine, spacer) => log(message, { |
||||||
|
color: 'greenBright', |
||||||
|
source: 'proc' || options && options.source, |
||||||
|
sourceColor: 'green', |
||||||
|
level: options && typeof options.level !== 'undefined' ? options.level : 0 |
||||||
|
}, newLine, spacer) |
||||||
|
}}; |
Loading…
Reference in new issue