
Log-Express
Advanced logging middleware for Express.js. Monitor your APIs with ease.
What is Log-Express?
Log-Express is a powerful middleware designed for Express.js to help you log API requests efficiently. With customizable log levels, and the ability to log to console and files, it's perfect for both small projects and large-scale applications.
Core Features
Flexible Log Levels
Supports log levels like trace, info, warn, and more.
Console & File Logging
Switch between logging to console and saving logs to files, or do both simultaneously.
Customizable Output
Define what gets logged, including HTTP methods, response time, IP, and more.
Quick Setup
Installation and setup take just a few minutes. Get up and running in no time.
Example Logs
Below are examples of logs generated by Log-Express for various API requests.
2024-09-18 14:37:12 [INFO]: GET /api/categories 200 12ms - 192.168.1.6
2024-09-18 14:38:25 [INFO]: POST /api/users 201 29ms - 192.168.1.7
2024-09-18 14:39:55 [ERROR]: GET /api/orders/999 500 60ms - 192.168.1.8
2024-09-18 14:40:30 [WARN]: PUT /api/products/456 400 22ms - 192.168.1.9
2024-09-18 14:41:10 [INFO]: GET /api/products 200 18ms - 192.168.1.10
2024-09-18 14:42:40 [INFO]: DELETE /api/orders/123 204 16ms - 192.168.1.11
2024-09-18 14:43:25 [ERROR]: POST /api/cart 500 50ms - 192.168.1.12
2024-09-18 14:44:55 [WARN]: GET /api/users/789 404 10ms - 192.168.1.13
2024-09-18 14:45:15 [INFO]: PUT /api/users/234 200 20ms - 192.168.1.14
2024-09-18 14:46:00 [INFO]: GET /api/stats 200 25ms - 192.168.1.15
2024-09-18 14:47:35 [ERROR]: DELETE /api/products/999 403 30ms - 192.168.1.16
2024-09-18 14:48:12 [WARN]: POST /api/orders 429 35ms - 192.168.1.17
2024-09-18 14:49:05 [INFO]: GET /api/cart 200 14ms - 192.168.1.18
2024-09-18 14:50:20 [WARN]: PUT /api/users/234 409 27ms - 192.168.1.19
2024-09-18 14:51:45 [INFO]: GET /api/reviews 200 19ms - 192.168.1.20
Customization Options
Log-Express provides several options to tailor logging to your needs:
- logLevel: Control verbosity by setting log levels like "info" or "error".
- consoleLog: Enable or disable console logging (default: true).
- saveLogs: Enable saving logs to files (default: false).
- logPerDay: Split logs by day for easier organization (default: false).