@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
function _interopDefault ( ex ) { return ( ex && ( typeof ex === 'object' ) && 'default' in ex ) ? ex [ 'default' ] : ex ; }
6
6
7
7
var util = _interopDefault ( require ( 'util' ) ) ;
8
- var _console = _interopDefault ( require ( 'console' ) ) ;
8
+ var console = require ( 'console' ) ;
9
9
var termNG = _interopDefault ( require ( 'term-ng' ) ) ;
10
10
var chalk = _interopDefault ( require ( 'chalk' ) ) ;
11
11
var sparkles = _interopDefault ( require ( 'sparkles' ) ) ;
@@ -52,7 +52,7 @@ const consoleFactory = function (options = {}) {
52
52
53
53
const prefixFormatter = ( pfix => pfix ? ( ) => `[${ pfix } ] ` : ( ) => '' ) ( prefix ) ;
54
54
55
- return Object . assign ( Object . create ( _console . Console ) , {
55
+ return Object . assign ( new console . Console ( sOut , sErr ) , {
56
56
_stdout : sOut ,
57
57
_stderr : sErr ,
58
58
threshold : verbosity ? verbosity : 3 ,
@@ -179,14 +179,14 @@ const consoleFactory = function (options = {}) {
179
179
sOut . write ( format ( inspect ( obj , options ) ) ) ;
180
180
} ,
181
181
182
- pretty ( obj , depth = 0 ) {
182
+ pretty ( obj , depth = 0 , color = true ) {
183
183
sOut . write ( format ( 'Content: %s\n' , inspect ( obj , {
184
184
depth,
185
- colors : termNG . color . basic
186
- } ) . slice ( 0 , - 1 ) . replace ( / ^ { / , 'Object\n ' ) . replace ( / ^ \[ / , 'Array\n ' ) . replace ( / ^ ( \w + ) { / , '$1' ) . replace ( / : / g, ' ▸' ) . replace ( / , \n / g, '\n' ) ) ) ;
185
+ colors : color && termNG . color . basic
186
+ } ) . slice ( 0 , - 1 ) . replace ( / ^ { / , 'Object\n ' ) . replace ( / ^ \[ / , 'Array\n ' ) . replace ( / ^ ( \w + ) { / , '$1' ) . replace ( / ( \w + ) : / g, '$1 ▸' ) . replace ( / , \n / g, '\n' ) ) ) ;
187
187
} ,
188
188
189
- yargs ( obj ) {
189
+ yargs ( obj , color = true ) {
190
190
const parsed = { } ;
191
191
Object . keys ( obj ) . forEach ( key_ => {
192
192
const val = obj [ key_ ] ;
@@ -211,15 +211,15 @@ const consoleFactory = function (options = {}) {
211
211
}
212
212
} ) ;
213
213
sOut . write ( format ( 'Options (yargs):\n %s\n' , inspect ( parsed , {
214
- colors : termNG . color . basic
215
- } ) . slice ( 2 , - 1 ) . replace ( / : / g, ' ▸' ) . replace ( / , \n / g, '\n' ) ) ) ;
214
+ colors : color && termNG . color . basic
215
+ } ) . slice ( 2 , - 1 ) . replace ( / ( \w + ) : / g, '$1 ▸' ) . replace ( / , \n / g, '\n' ) ) ) ;
216
216
}
217
217
218
218
} ) ;
219
219
} ;
220
220
221
221
222
- function console ( options ) {
222
+ function console$1 ( options ) {
223
223
return consoleFactory ( options ) ;
224
224
}
225
225
@@ -229,6 +229,6 @@ function createConsole(options) {
229
229
230
230
const getVersion = level => metadata . version ( level ) ;
231
231
232
- exports . console = console ;
232
+ exports . console = console$1 ;
233
233
exports . createConsole = createConsole ;
234
234
exports . getVersion = getVersion ;
0 commit comments