Skip to content

Commit

Permalink
add DEBUG usage docs. Closes #41
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Nov 27, 2013
1 parent 309f2ac commit 81d027e
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function logger(format){
.replace(':url', this.url);

console.log(str);

yield next;
}
}
Expand All @@ -103,8 +103,7 @@ app.use(logger(':method :url'));

### Named middleware

Naming middleware is optional, however it's useful for debugging purposes to
assign a name.
Naming middleware is optional, however it's useful for debugging purposes to assign a name.

```js
function logger(format){
Expand Down Expand Up @@ -136,3 +135,20 @@ app.use(function *(){
});
```

## Debugging Koa

Koa along with many of the libraries it's built with support the __DEBUG__ environment variable from [debug](https://github.com/visionmedia/debug) which provides simple conditional logging.

For example
to see all koa-specific debugging information just pass `DEBUG=koa*` and upon boot you'll see the list of middleware used, among other things.

```
$ DEBUG=koa* node --harmony examples/simple
koa:application use responseTime +0ms
koa:application use logger +4ms
koa:application use contentLength +0ms
koa:application use notfound +0ms
koa:application use response +0ms
koa:application listen +0ms
```

0 comments on commit 81d027e

Please sign in to comment.