show-log-lines

1.0.8 • Public • Published

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

Image

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 to util.inspect() method. The default is :

    { depth: 4, showHidden: false, colors: true, compact: true }

Package Sidebar

Install

npm i show-log-lines

Weekly Downloads

2

Version

1.0.8

License

MIT

Unpacked Size

5.93 kB

Total Files

3

Last publish

Collaborators

  • nguru