
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
fastapi-logging-middleware
Advanced tools
Beautiful, colorful HTTP request logs in Go-style format for FastAPI applications
A beautiful, colorful HTTP request logging middleware for FastAPI applications that provides Go-style formatted logs. The middleware automatically captures and logs detailed information about each incoming request, including timing, client IP, HTTP method, and response status with color-coded output.
The middleware extracts client IP addresses from various sources including direct client connection, X-Forwarded-For
, and X-Real-IP
headers by default. Request duration is automatically calculated and displayed in the most appropriate unit (microseconds, milliseconds, or seconds) for optimal readability.
Install the package using pip:
pip install fastapi-logging-middleware
from fastapi import FastAPI
from logging_middleware import GoStyleLoggingMiddleware
app = FastAPI()
# Add the middleware
app.add_middleware(GoStyleLoggingMiddleware)
@app.get("/")
async def root():
return {"message": "Hello World"}
from fastapi import FastAPI
from starlette.middleware import Middleware
from logging_middleware import GoStyleLoggingMiddleware
# Add middleware during app creation
app = FastAPI(
middleware=[
Middleware(GoStyleLoggingMiddleware)
]
)
@app.get("/")
async def root():
return {"message": "Hello World"}
The middleware outputs logs in the following format:
YYYY-MM-DD HH:MM:SS.ffffff [STATUS] | DURATION | CLIENT_IP | [METHOD] "PATH?QUERY"
Status Codes:
HTTP Methods:
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Beautiful, colorful HTTP request logs in Go-style format for FastAPI applications
We found that fastapi-logging-middleware demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.