# koa-morgan

> HTTP request logger middleware for koa

Latest version **1.0.1** (published 2015-12-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install koa-morgan
pnpm add koa-morgan
yarn add koa-morgan
bun add koa-morgan
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-12-25 |
| First published | 2015-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/koa-morgan) |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 63 |
| Author | Fangdun Cai |
| Maintainers | fundon |
| Keywords | logger, morgan |

## Links

- npm: https://www.npmjs.com/package/koa-morgan
- Repository: https://github.com/koa-modules/morgan
- Homepage: https://github.com/koa-modules/morgan#readme
- Issues: https://github.com/koa-modules/morgan/issues
- npm.io page: https://npm.io/package/koa-morgan

## Dependencies (1)

- [morgan](https://npm.io/package/morgan.md) ^1.6.1

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2015-12-25
- 1.0.0 — 2015-11-24
- 1.0.0-alpha.1 — 2015-11-22
- 0.4.0 — 2015-09-24
- 0.3.0 — 2015-06-19
- 0.2.1 — 2015-05-11
- 0.2.0 — 2015-04-02
- 0.1.0 — 2015-03-03
- 0.0.2 — 2015-03-02
- 0.0.1 — 2015-03-02

## README

# koa-morgan

> HTTP request logger middleware for koa.  
> [morgan] wrapper for koa's middleware.

[![NPM version][npm-img]][npm-url]
[![NPM Downloads][downloads-image]][npm-url]
[![Build status][travis-img]][travis-url]
[![Test coverage][coveralls-img]][coveralls-url]
[![Dependency status][david-img]][david-url]
[![License][license-img]][license-url]

## Install

```sh
$ npm install --save koa-morgan
```

## Usage

### **=1.x**, 100%, working with **morgan** and **koa-v2**

```js
const fs = require('fs')
const Koa = require('koa')
const morgan = require('koa-morgan')

// create a write stream (in append mode)
const accessLogStream = fs.createWriteStream(__dirname + '/access.log',
                                             { flags: 'a' })
const app = new Koa()

// setup the logger
app.use(morgan('combined', { stream: accessLogStream }))

app.use((ctx) => {
  ctx.body = 'hello, world!'
})

app.listen(2333)
```

### **=0.x**, working with **koa-v1**

```js
var koa = require('koa');
var morgan = require('koa-morgan');
var app = koa();

app.use(morgan.middleware(format, options));

```

[npm-img]: https://img.shields.io/npm/v/koa-morgan.svg?style=flat-square
[npm-url]: https://npmjs.org/package/koa-morgan
[travis-img]: https://img.shields.io/travis/koa-modules/morgan.svg?style=flat-square
[travis-url]: https://travis-ci.org/koa-modules/morgan
[coveralls-img]: https://img.shields.io/coveralls/koa-modules/morgan.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/koa-modules/morgan?branch=master
[license-img]: https://img.shields.io/badge/license-MIT-green.svg?style=flat-square
[license-url]: LICENSE
[david-img]: https://img.shields.io/david/koa-modules/morgan.svg?style=flat-square
[david-url]: https://david-dm.org/koa-modules/morgan
[downloads-image]: https://img.shields.io/npm/dm/koa-morgan.svg?style=flat-square
[morgan]: https://github.com/expressjs/morgan

---
_Source: https://npm.io/package/koa-morgan · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
