<commit_before># express-debug
express-debug is a development tool for expressjs. It's simple middleware that
injects useful debugging output into your html, in a non-obstructive way.

It adds an 'EDT' tab to the right side of pages that, when clicked, displays info
such as template variables (locals), current session, useful request data, and
current template.

express-debug should *NOT* be used in production environments.

Compatible with express 3.x


### Settings

`depth` - How deep to recurse through printed objects. (Default: `4`)

`theme` - Absolute path to a css file to include and override EDT's default css.

`extra_panels` - additional panels to show. See docs below and included panels for proper structure, each panel is an object (Default: `[]`)

`panels` - allows changing the default panels (ex: remove a panel) (Default: `['locals', 'request', 'session', 'template', 'software_info']`)


### Usage

#### Install
`npm install express-debug --save-dev`

#### Use
```js
var express = require('express');
var app = express();
var edt = require('express-debug');

// invoke with profiler
app.use(edt(app, {/* settings */}));

// OR invoke without profiler
app.use(edt({/* settings */}));


/* ... application logic ... */
```


### Panels

`locals` - app.locals, res.locals, and options passed to the template (merged into res.locals)

`request` - req info. ip, body, query, files, route info, cookies, headers

`session` - everything in req.session

`template` - view name, template file

`software_info` - shows current versions of node and libraries installed locally (not globally installed packages!)

`profile` - total req processing time. middleware, param, and route timings.
(**Note:** This panel is auto-loaded when app is passed in to edt(), and should not be explicitly added to settings.)

#### Custom Panels
Each panel is an object, in the form:

```js
my_panel = {
    name: 'panel_name',
    template: '/absolute/path/to/template.jade',
    process: function(locals){
        // locals: {app, req, res, view, locals}

        // ... logic here ...
        return { locals: {/* my template locals */}};
    }
}
```
Optionally, panels supports the following optional additional properties:

initialize:
```js
my_panel.initialize = function(app) {
    // perform initialization here, when the application loads
}
```

request:
```js
my_panel.request = function(req) {
    // perform initialization here, for every request
}
```

finalize:
```js
my_panel.finalize = function(req) {
    // finish up here, before rendering anything
}
```


### TODO
* profile template rendering
* improve styling


### Issues
Pull requests, feature requests, bug reports, and style breakage reports welcome!


### Changelog
* **0.2.2**
  * finalize panel api


* **0.2.1**
  * add profiler panel
  * modified style


* **0.2.0**
  * pluggable panels
  * theme addition and bugfix by jaketrent


* **0.1.2**
  * objects can now be collapsed
  * functions are now collapsed by default, showing only # of formal args and name, but can be expanded
  * separated css and js from main toolbar template


* **0.1.1**
  * remove environment checks
  * fix "view engine" directive, make template reading safer


### License - MIT
Copyright (c) 2013 <NAME> and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of<commit_msg>update docs<commit_after># express-debug
express-debug is a development tool for expressjs. It's simple middleware that
injects useful debugging output into your html, in a non-obstructive way.

It adds an 'EDT' tab to the right side of pages that, when clicked, displays info
such as template variables (locals), current session, useful request data, and
current template.

express-debug should *NOT* be used in production environments.

Compatible with express 3.x


### Settings

`depth` - How deep to recurse through printed objects. (Default: `4`)

`theme` - Absolute path to a css file to include and override EDT's default css.

`extra_panels` - additional panels to show. See docs below and included panels for proper structure, each panel is an object (Default: `[]`)

`panels` - allows changing the default panels (ex: remove a panel) (Default: `['locals', 'request', 'session', 'template', 'software_info']`)


### Usage

#### Install
`npm install express-debug --save-dev`

#### Use
```js
var express = require('express');
var app = express();
var edt = require('express-debug');

// invoke with profiler
app.use(edt(app, {/* settings */}));

// OR invoke without profiler
app.use(edt({/* settings */}));


/* ... application logic ... */
```


### Panels

`locals` - app.locals, res.locals, and options passed to the template (merged into res.locals)

`request` - req info. ip, body, query, files, route info, cookies, headers

`session` - everything in req.session

`template` - view name, template file

`software_info` - shows current versions of node and libraries installed locally (not globally installed packages!)

`profile` - total req processing time. middleware, param, and route timings.
(**Note:** This panel is auto-loaded when app is passed in to edt(), and should not be explicitly added to settings.)

#### Custom Panels
Each panel is an object, in the form:

```js
my_panel = {
    name: 'panel_name',
    template: '/absolute/path/to/template.jade',
    process: function(locals){
        // locals: {app, req, res, view, locals}

        // ... logic here ...
        return { locals: {/* my template locals */}};
    }
}
```
Optionally, panels supports the following optional additional properties:

initialize:
```js
my_panel.initialize = function(app) {
    // perform initialization here, when the application loads
}
```

request:
```js
my_panel.request = function(req) {
    // perform initialization here, for every request
}
```

finalize:
```js
my_panel.finalize = function(req) {
    // finish up here, before rendering anything
}
```


### TODO
* profile template rendering
* improve styling


### Issues
Pull requests, feature requests, bug reports, and style breakage reports welcome!


### Changelog
* **0.2.3**
  * add software info panel
  * clean up

* **0.2.2**
  * finalize panel api


* **0.2.1**
  * add profiler panel
  * modified style


* **0.2.0**
  * pluggable panels
  * theme addition and bugfix by jaketrent


* **0.1.2**
  * objects can now be collapsed
  * functions are now collapsed by default, showing only # of formal args and name, but can be expanded
  * separated css and js from main toolbar template


* **0.1.1**
  * remove environment checks
  * fix "view engine" directive, make template reading safer


### License - MIT
Copyright (c) 2013 <NAME> and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of
{'fraction_non_alphanumeric': 0.12002945508100148, 'fraction_numerical': 0.0066273932253313695, 'mean_word_length': 3.8128986534372786, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1479154', 'n_tokens_mistral': 2003, 'n_tokens_neox': 1909, 'n_words': 819}