Skip to content

Log file path and method called to terminal nodejs

Notifications You must be signed in to change notification settings

ngvcanh/node-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-log

Log file path and method called to terminal nodejs

Usage

This package only support Node environment.

Only import/require from main file of project.

With JavaScript:

// src/index.js
require('@kensoni/log');

// More code here

With Typescript:

// src/index.ts
import '@kensoni/log';

// More code here

Call __log() function anywhere that you want to show log.

__log();

Using as console.log:

__log(msg1, msg2, msg3, ...);

The format log message show to terminal

<time>ms [ <000> <line> :: <file path> ] <method> 👉 <message passed>

Demo:

Demo Show log

Note

This package always shows the log whether the environment is production or development.

To disable this feature without removing the code make sure that process.env.DEBUG_LOG_DISABLED flag is a truthy.

To change length of zero before line value. Let set process.env.DEBUG_LOG_MIN_COLUMNS (default: 6). If value less than 6, it will use default value.

This function with replace console.log if process.env.DEBUG_LOG_REPLACE_CONSOLE is truthy.

About

Log file path and method called to terminal nodejs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published