https://github.com/lukks/tiny-log-http
Simple middleware for logging requests
https://github.com/lukks/tiny-log-http
Last synced: 6 months ago
JSON representation
Simple middleware for logging requests
- Host: GitHub
- URL: https://github.com/lukks/tiny-log-http
- Owner: LuKks
- License: mit
- Created: 2023-12-16T16:29:53.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-16T17:17:53.000Z (about 2 years ago)
- Last Synced: 2025-07-04T10:16:11.127Z (6 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tiny-log-http
Simple middleware for logging requests
```
npm i tiny-log-http
```
## Usage
```js
const express = require('express')
const logHTTP = require('tiny-log-http')
const app = express()
app.use(logHTTP())
app.get('/', function (req, res) {
res.json('Hello World!')
})
app.listen(3000)
```
## API
#### `const middleware = logHTTP([options])`
Available `options`:
```js
{
enable: true,
trustProxy: false, // Uses 'x-forwarded-for' header for the IP
cloudflare: false, // Uses 'cf-ipcountry' header for the country
ignoreIPs: [],
ignoreURLs: [],
headers: false,
body: false,
userAgent: true
}
```
## License
MIT