https://github.com/kth/kth-node-access-log
Access log module for node applications
https://github.com/kth/kth-node-access-log
Last synced: 4 months ago
JSON representation
Access log module for node applications
- Host: GitHub
- URL: https://github.com/kth/kth-node-access-log
- Owner: KTH
- License: mit
- Created: 2016-08-31T13:00:42.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-11-01T04:19:28.000Z (over 1 year ago)
- Last Synced: 2024-12-30T11:32:14.987Z (over 1 year ago)
- Language: JavaScript
- Size: 52.7 KB
- Stars: 0
- Watchers: 21
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kth-node-access-log [](https://travis-ci.org/kth/kth-node-access-log)
Access log middleware for KTH node apps.
## Usage
```javascript
const express = require("express");
const app = express();
const accessLog = require("kth-node-access-log");
// express setup
app.use(accessLog({ useAccessLog: true }));
// later ...
app.listen(3000);
```
## Options
- `useAccessLog` toggles the access log on or off. Defaults to `false`.
- `stripHeaders` contains a list of headers that should be stripped from
their query string before inserted into the log entry. Defaults to:
```javascript
["referer", "x-forwarded-for"];
```
- `format` is the access log format. Defaults to:
```javascript
':remote-addr - :x-forwarded-for :remote-user [:date[iso]] ":method :url HTTP/:http-version" :status :res[content-length] ":referer" ":user-agent"';
```
- `morganOptions` options passed directly to morgan. Defaults to an
empty object.