0.1.0 • Published 8 years ago
jk-debug v0.1.0
JK-Debug
A pithy debugging helper that can define middlewares to fit your dev flavor.
Installation
$ npm i jk-debugUsage
To see how to use the helper, check the example.js.
If you are interested in the middleware implementation, ref to js-middleware.
API
Env Util
debugDetector(isDebug) -> boolean- Enable debugging mode via query stringdebugor env variableDEBUG.
Base Class
new DebugWrapper(options) -> debugInstance- Create and return adebugInstance.
Options Parameter Table:
| Parameter | Type | Required? | Description |
|---|---|---|---|
| isDebug | boolean | optional | By default debugging is enabled |
| middlewareObject | object | optional | Apply the middleware object to the current context |
Instance Methods
isDebugEnabled() -> boolean- Determine the debug runtime env.switchDebuggingMode(isDebug)- Enable/Disable the debugging mode.log(message, ...arg)- Likeconsole.log, but flexible and composable.error(messageOrOptions, ...arg)- Ditto, but support for detailed options.getTimingResults() -> ParsedTiming- Monitor the performance of page load/render.