babel-plugin-pretty-console
v1.1.2
Published
Use hooks for fast log
Downloads
19
Readme
Install
npm install babel-plugin-pretty-console -D
Usage
Configure PrettyConsole
to your .babelrc
file.
{
"plugins": ["pretty-console"]
}
Examples
// #
function add(a, b) {
return a + b;
}
// equals:
function add(a, b) {
console.log('add:a', a)
console.log('add:b', b)
return a + b;
}
// #warn
let a = add(1, 2)
// equals:
let a = add(1, 2)
console.warn(a)
// #error TestFunction
let add = (a, b) => a + b
// equals:
let add = (a, b) => {
console.error('TestFunction:a', a)
console.error('TestFunction:b', b)
return a + b
}
Plugin options
- token
Set hook token used in comments
- open
Set plugin enabled status
- printFileName
Set print filename to console.log
Comments hook options
// token[consoleType] [hookName]
// ex:
// #warn TestFunction