Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/koajs/accesslog
Middleware for common log format access logs
https://github.com/koajs/accesslog
Last synced: 2 months ago
JSON representation
Middleware for common log format access logs
- Host: GitHub
- URL: https://github.com/koajs/accesslog
- Owner: koajs
- License: mit
- Created: 2014-11-19T12:43:54.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2020-07-09T11:59:53.000Z (over 4 years ago)
- Last Synced: 2024-04-14T13:08:39.049Z (8 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 19
- Watchers: 7
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-koa - accesslog - Middleware for common log format access logs (Middleware)
- awesome-koa - koa-accesslog - 通用日志格式访问日志的中间件。 ![](https://img.shields.io/github/stars/koajs/accesslog.svg?style=social&label=Star) ![](https://img.shields.io/npm/dm/koa-accesslog.svg?style=flat-square) (仓库 / 中间件)
README
# [Accesslog](https://github.com/koajs/accesslog)
Output [Common Log Format](http://en.wikipedia.org/wiki/Common_Log_Format) access logs to any stream. Defaults to `process.stdout`.
## Install
```bash
# npm ..
npm i koa-accesslog
# yarn ..
yarn add koa-accesslog
```## Usage
```js
const Koa = require('koa');
const accesslog = require('koa-accesslog');
const app = new Koa();app.use(accesslog());
```## Output
```
127.0.0.1 - - [19/Nov/2014:13:47:37 +0100] "GET / HTTP/1.X" 404 -
```## Configure
You may configure Accesslog to use any writable stream such as an
instance of `stream.PassThrough` as seen below.```js
const log = new stream.PassThrough();
app.use(accesslog(log));
```## License
[MIT](LICENSE)