fliplog
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -284,3 +284,3 @@ const {inspector} = require('../modules/inspector-gadget') | ||
msg = inspector(msg, this.get('verbose')) | ||
msg = inspector(msg, this.get('verbose'), this.get('argv.inspector')) | ||
} | ||
@@ -287,0 +287,0 @@ |
@@ -10,4 +10,5 @@ const {combinations} = require('../deps') | ||
combinations.forEach(color => { | ||
this[color] = text => { | ||
return this.color(color).text(text) | ||
this[color] = (text = null) => { | ||
if (text !== null) this.text(text) | ||
return this.color(color) | ||
} | ||
@@ -14,0 +15,0 @@ }) |
@@ -8,3 +8,3 @@ { | ||
"name": "fliplog", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"main": "index.js", | ||
@@ -11,0 +11,0 @@ "description": "fluent logging with verbose insight, colors, tables, emoji, filtering, spinners, progress bars, timestamps, capturing, stack traces, clearing, & presets", |
@@ -42,6 +42,7 @@ module.exports = { | ||
} | ||
let opts = options || this.get('boxStyles') | ||
const box = boxen(input, options || this.get('boxStyles')) | ||
const box = boxen(input, opts) | ||
if (options && options.default === true) { | ||
if (opts && opts.default === true) { | ||
this.text(box) | ||
@@ -48,0 +49,0 @@ } |
@@ -0,12 +1,49 @@ | ||
// const toarr = require('chain-able/deps/to-arr') | ||
let fwf | ||
module.exports = { | ||
reset() { | ||
if ( | ||
process.argv.includes('flipdebug=verbose') || | ||
process.argv.includes('--flipdebug=verbose') | ||
) { | ||
return this.set('filter', ['*']) | ||
if (!fwf) fwf = require('../modules/funwithflags') | ||
const argv = fwf(process.argv.slice(2), { | ||
number: ['DEBUG_DEPTH'], | ||
boolean: ['DEBUG_SHOW_HIDDEN', 'DEBUG_COLORS'], | ||
string: ['fliplog', 'DEBUG'], | ||
alias: { | ||
fliplog: ['flipdebug'], | ||
}, | ||
default: { | ||
DEBUG: false, | ||
DEBUG_DEPTH: 30, | ||
DEBUG_SHOW_HIDDEN: true, | ||
DEBUG_COLORS: true, | ||
}, | ||
}) | ||
const {DEBUG_DEPTH, DEBUG_SHOW_HIDDEN, DEBUG_COLORS, DEBUG} = argv | ||
if (DEBUG_COLORS === false) { | ||
this.strip() | ||
} | ||
this.set('argv.inspector', { | ||
depth: DEBUG_DEPTH, | ||
maxArrayLength: DEBUG_DEPTH, | ||
showHidden: DEBUG_SHOW_HIDDEN, | ||
showProxy: true, | ||
colors: DEBUG_COLORS, | ||
}) | ||
if (DEBUG) { | ||
this.delete('filter') | ||
this.filter(DEBUG) | ||
} | ||
// @TODO: filters | ||
// if (DEBUG) { | ||
// this.set('filter', DEBUG) | ||
// } | ||
return this | ||
}, | ||
} |
const interoplateRegExp = /%[sdj%]/g | ||
const {OFF} = require('../deps') | ||
// https://coderwall.com/p/blti_w/dumb-javascript-string-interpolation | ||
@@ -9,2 +9,4 @@ // https://nodejs.org/api/util.html#util_util_format_format | ||
const isOFF = x => x === OFF || (/undefined/).test(x) | ||
module.exports = { | ||
@@ -24,4 +26,6 @@ reset() { | ||
return this | ||
.set('textFormatter', txt => this.requirePkg('strip-ansi')(txt)) | ||
.set('colorer', color => txt => this.requirePkg('strip-ansi')(txt)) | ||
.set('textFormatter', txt => | ||
isOFF(txt) ? OFF : this.requirePkg('strip-ansi')(txt)) | ||
.set('colorer', color => txt => | ||
isOFF(txt) ? OFF : this.requirePkg('strip-ansi')(txt)) | ||
}, | ||
@@ -28,0 +32,0 @@ |
3066706
229
27446