Scharff Logger
Scharff is a lightweight and versatile Node.js package designed to enhance your application's logging capabilities by seamlessly integrating a powerful outgoing request logger. With Scharff, you can effortlessly gain insights into the interactions your application has with external services, APIs, and resources.
Installation
- run
npm install scharff. - fork the git repository
https://github.com/Minka1902/scharff.git, and place it next to your project.
Usage
- in your entry point, import unregister from the package:
const listen = require('scharff'); - to stop the logger just run the unregister function:
listen(), ornpm uninstall scharffin the terminal.
What to expect
- The package will create a outgoingRequest.log file and start logging the requests to the file.
- In there you can see the fetch requests you sent.
- The request will be in the format below:
{
"url":"http://666.777.888.999:3000/update/www.exampe.com",
"ip":"130.130.130.130",
"date":{
date:"20/20/2020",
time:"2020 PM"
},
"originUrl":"/update/www.example.com",
"method":"PUT",
"headers":{
"Content-Type":"application/json",
"Access-Control-Allow-Origin":"*"
},
"body":{
"isActive":true,
"status":200,
"lastChecked":"2020-20-20T2020.200Z"
}
}
New in this release
- Fixed a bug in the installation
Requirements
- nodejs version >= v18.0.0
Future additions
- Set the log file name
- Request error logger
- Response logger
- Response error logger