From 81d027eca78c00aed4638d40989c9afc41cae588 Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Tue, 26 Nov 2013 21:37:22 -0800 Subject: [PATCH] add DEBUG usage docs. Closes #41 --- docs/guide.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) 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 +``` +