cl-print v2.3.3
š cl-print - Log with Filename & Line Number
cl-print
is a lightweight and powerful npm package that enhances your console logging by automatically adding filename and line number to each log statement. With this package, debugging becomes a breeze as you can immediately see where your logs are coming from.
š Features
- ⨠Automatically prepends the filename and line number to every
console.log
statement. - šÆ No manual effort required to track logs.
- š ļø Works out of the box, just replace
console.log
withclPrint
. - š§āš» Helps in debugging by providing clear and concise context.
š¦ Installation
You can easily install cl-print
via npm:
npm install cl-print
š„ļø Usage
Once installed, just require or import the package and use it like you would use console.log
.
Example
const {cl} = require('cl-print');
cl('Hello, World!');
// Output: [xyz.js:15] Hello, World!
In this example, the log message will display the filename (xyz.js
) and the line number (15
), showing exactly where the log was made.
š” Sample Output
Suppose you have a file app.js
with the following code:
const {cl} = require('cl-print');
function greet() {
cl('Hello, this is a test log!');
}
greet();
The output in your console will look like:
[app.js:4] Hello, this is a test log!
As you can see, it includes the filename (app.js
) and the line number (4
), making it incredibly easy to track the source of your log.
š„ Why Choose cl-print?
- Instant Context: Get a clear picture of where your logs are being triggered without any extra effort.
- Simplified Debugging: No more guessing or searching for log statements ā it's all right there.
- Zero Configuration: Just install and use it like
console.log
, and you're good to go. - Perfect for Teams: Everyone on the team can easily identify log origins, which improves collaboration and productivity.
š Quick Start
const {cl} = require('cl-print');
// Using it like console.log, but with filename and line number
cl('This is a log with context!');
Output:
[app.js:10] This is a log with context!
š¤ Contributing
We welcome contributions! If you find bugs, or want to add features, feel free to fork the repository and submit a pull request. Here's how you can contribute:
- Fork this repository
- Create a new branch (
git checkout -b feature-branch
) - Make your changes
- Commit your changes (
git commit -am 'Add new feature'
) - Push to the branch (
git push origin feature-branch
) - Submit a pull request
š License
This project is licensed under the MIT License. See the LICENSE file for more details.
šØāš» Author
Developed and maintained by Krishna Kumar. Feel free to reach out for questions, suggestions, or collaborations! š
š Keywords console.log debugging log developer-tools debug filename line-number nodejs logging log-with-context nodejs-logging console-enhancer cl-print
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago