JSdebugger
A suite of tools to debug your JavaScript in the browser and in Node.
Overview
JSdebugger uses morgan to log HTTP requests, log4js-node for node and js-logger for the browser.
Wraps js-logger and log4js-node with a unique API and some default values.
Install
npm install js-debugger
How it works
browser
Options
Name | Type | Default | Description |
---|---|---|---|
disabled | Boolean |
false | If set to true disable all logs. |
globalDebug | string |
false | A name for the global debug variable. |
globalConsole | string |
false | A name for the global console variable. |
level | string |
'error' | Default maximun level. |
Exemple
; // passing optionsconst debug = ;const _log = ; // or using the default optionsconst _log = ; _log;_log;_log;_log;_log;_log;_log;
Node
You can use all the options from the browser plus this ones:
Options
Name | Type | Default | Description |
---|---|---|---|
line | Boolean Object |
false | Display line numbe, see line. |
morgan | Object |
undefined | Options for morgan, see morgan. |
notify | Object |
undefined | Options for notify, see notify. |
line
Enable line number, thanks to log4js-node-extend.
line: true; // or line: path: __dirname format: 'at @name (@file:@line:@column)';
morgan
Enable morgan with express, please check the API.
morgan: app: app // The express app object. format: 'dev' // morgan format. opts: {} // morgan options.;
notify
Enable notifications by email, please check the API.
morgan: smtp: Object // The SMTP object. email: from: string to: string subject: string ;
Exemple
const jsdebugger = ; // passing optionsconst debug = ;const _log = ; // or using the default optionsconst _log = ; _log;_log;_log;_log;_log;_log;_log;
Contributing
Test
The unit test are written in Mocha.
Please add a unit test for every new feature or bug fix. npm test
will run the tests.
Documentation
Please read and add documentation for every API change.
Feel free to contribute!
License
Copyright (c) 2017 Bruno Santos Licensed under the MIT license.