1.0.8 • Published 12 months ago

mb64-logs v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

About the mb64-logs package:

# mb64-logs

`mb64-logs` is an npm package that provides middleware for logging detailed request and response information in your Express.js applications. It helps developers gain insights into the API requests and responses by logging comprehensive details about each transaction, making it easier to debug and monitor their applications.

## Installation

You can install `mb64-logs` using npm:

```bash
npm install mb64-logs

Usage

Here's an example of how to use mb64-logs in an Express.js application:

const express = require("express");
const cors = require("cors");
const mblogs = require("mb64-logs");
const app = express();
const port = 3000;

app.use(cors());
mblogs(app);

app.post("/", (req, res) => {
  res.send("mblogs");
});

app.listen(port, () => {
  console.log(`Server is running on http://localhost:${port}`);
});

Example Request Log

Here's an example of the detailed request log that mb64-logs will produce:

--- Detailed Request Log ---
Method: POST
URL: /?api=asdosd
Status Code: 200
Status Description: OK
IP Address: ::1
HTTP Version: HTTP/1.1
Content Length: 6
User-Agent: PostmanRuntime/7.40.0
Response Time: undefined ms
Request Headers: {
  "content-type": "application/json",
  "user-agent": "PostmanRuntime/7.40.0",
  "accept": "*/*",
  "postman-token": "99ed9ddd-4a4c-4811-a377-b4a26e756df3",
  "host": "localhost:3000",
  "accept-encoding": "gzip, deflate, br",
  "connection": "keep-alive",
  "content-length": "26"
}
Request Params: {}
Request Query: {
  "api": "asdosd"
}
Request Body: {
  "type": "mblogs"
}
Response Body: mblogs
----------------------------------

POST /?api=asdosd 200 OK ::1 HTTP/1.1 6 "PostmanRuntime/7.40.0" - 0.790 ms

Features

  • Logs detailed information about each request and response, including headers, parameters, query strings, and body.
  • Easy to integrate with Express.js applications.
  • Helps with debugging and monitoring of API requests by providing comprehensive logs that detail each aspect of the transaction.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License.

Author

Manoj Gowda B R

Contact


1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago