show-log-lines
v1.0.8
Published
Simple module that shows you where all ytour console.logs are for even better code debugging.
Downloads
9
Maintainers
Readme
How about simplifying your logs?
When coding in Javascript, many developers have the habit of using console.log
to track their code and test variables.
However, as the project increases in complexity and size, these logs can get lost in your code and tracing them becomes another task altogether!
This module patches the console.log
method so that it also logs all important information about where every log is to be found.
Usage
Install using yarn add show-log-lines
Then require the module at the very top of your project: javascript require('show-log-lines');
Example
// require module at the very top
require('show-log-lines')({ short: false });
// log something
console.log('Hello ' + test_function());
function test_function() {
// log something else inside function
console.log('Inside Test Function');
return 'World';
}
Result
The code above will output something like this
Options
short
: which is a boolean value. The default is true which prints only the line number.ignorePaths
: a glob path or list of globs from which paths this module will not decorate the logs. Example:['**/node_modules/moleculer/**']
will ignore all logs emanating from the moleculer module. Picomatch is used to match globs so check out their readme.utilInspect
: an object containing values to be passed toutil.inspect()
method. The default is :{ depth: 4, showHidden: false, colors: true, compact: true }