diff --git a/docs/guide.md b/docs/guide.md index f93302f..bed48e3 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -92,7 +92,7 @@ function logger(format){ .replace(':url', this.url); console.log(str); - + yield next; } } @@ -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){ @@ -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 +``` +