
Security News
curl Shuts Down Bug Bounty Program After Flood of AI Slop Reports
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.
@flatfile/http-logger
Advanced tools
A lightweight, flexible HTTP request logger for Node.js applications that provides detailed logging for HTTP requests.
# npm
npm install @flatfile/http-logger
# yarn
yarn add @flatfile/http-logger
# pnpm
pnpm add @flatfile/http-logger
# bun
bun add @flatfile/http-logger
The simplest way to use this library is with the auto-initializing import that automatically instruments all HTTP requests:
// Import the /init version to automatically instrument requests
import '@flatfile/http-logger/init';
// That's it! All HTTP requests will now be automatically logged
Alternatively, you can explicitly initialize the logger:
import { instrumentRequests } from '@flatfile/http-logger';
// Call this early in your application startup
instrumentRequests();
// All HTTP requests will now be automatically logged
You can also manually log HTTP requests:
import { logHttpRequest } from '@flatfile/http-logger';
// Log a request manually
logHttpRequest({
method: 'GET',
url: 'https://api.example.com/data',
startTime: new Date(), // when the request started
statusCode: 200,
headers: { 'content-type': 'application/json' },
requestSize: 0,
responseSize: 1024,
isStreaming: false
});
instrumentRequests()Patches the native HTTP modules and fetch API to automatically log all HTTP requests. This should be called early in your application.
import { instrumentRequests } from '@flatfile/http-logger';
instrumentRequests();
logHttpRequest(logData)Logs HTTP request details to both Flatfile's internal debugger and any global HTTP logger.
Parameters:
| Parameter | Type | Description |
|---|---|---|
logData.error | boolean | Whether the request resulted in an error |
logData.method | string | HTTP method used (GET, POST, etc.) |
logData.url | string | Request URL |
logData.startTime | Date | When the request started |
logData.headers | Object | Response headers |
logData.statusCode | number | Response status code |
logData.requestSize | number | Size of request in bytes |
logData.responseSize | number | Size of response in bytes |
logData.isStreaming | boolean | Whether this is a streaming response |
The library patches Node's native HTTP/HTTPS modules and the global fetch API to intercept requests and responses. It calculates timing and size information, and handles streaming responses appropriately.
For streaming responses, it logs information as soon as headers are received, while for regular responses it waits until the full response is received.
In AWS Lambda or CI environments, ANSI color codes are automatically stripped from console output to improve log readability.
MIT
FAQs
A lightweight, flexible HTTP request logger for Node.js applications
We found that @flatfile/http-logger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 14 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A surge of AI-generated vulnerability reports has pushed open source maintainers to rethink bug bounties and tighten security disclosure processes.

Product
Scan results now load faster and remain consistent over time, with stable URLs and on-demand rescans for fresh security data.

Product
Socket's new Alert Details page is designed to surface more context, with a clearer layout, reachability dependency chains, and structured review.