Skip to content

Commit

Permalink
updated README.md package.json for NPM
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeOsdDev committed Nov 3, 2012
1 parent 14e3cc9 commit fa6f3de
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ Some debug utility for both server-side and client-side javascript.
```bash ```bash
npm install --save debug-util npm install --save debug-util
``` ```

and and

```javascript ```javascript
var debugUtil = require('debug-util'); var debugUtil = require('debug-util');
``` ```

### Client Side ### Client Side


```html ```html
Expand All @@ -22,12 +25,15 @@ Client Side, `debugUtil` object is defined as `window.debugUtil`


## Usage ## Usage
### getColorLogger(name,level,color) ### getColorLogger(name,level,color)

```javascript ```javascript
logger = debugUtil.getColorLogger("myLogger","info","cyan"); logger = debugUtil.getColorLogger("myLogger","info","cyan");
logger.log("message"); logger.log("message");
``` ```

e.g. e.g.
this code will display like this this code will display like this

```javascript ```javascript
defaultLogger = debugUtil.getColorLogger(); defaultLogger = debugUtil.getColorLogger();
defaultLogger.log("This line is 'debug' level and color is 'default'"); defaultLogger.log("This line is 'debug' level and color is 'default'");
Expand All @@ -37,40 +43,46 @@ defaultLogger.warn("This line is 'warn' level and color is 'yellow'");
defaultLogger.info("This line is 'info' level and color is 'cyan'"); defaultLogger.info("This line is 'info' level and color is 'cyan'");
defaultLogger.debug("This line is 'debug' level and color is 'default'"); defaultLogger.debug("This line is 'debug' level and color is 'default'");
defaultLogger.trace("This line is 'trace' level and color is 'white'"); defaultLogger.trace("This line is 'trace' level and color is 'white'");

//Set Name and Level //Set Name and Level
appLogger = debugUtil.getColorLogger("App","info"); appLogger = debugUtil.getColorLogger("App","info");
appLogger.log("This line is 'info' level and color is 'default' and appender name is 'App'"); appLogger.log("This line is 'info' level and color is 'default' and appender name is 'App'");

//Set Name, Level and Color //Set Name, Level and Color
sysLogger = debugUtil.getColorLogger("Sys","warn","magenta"); sysLogger = debugUtil.getColorLogger("Sys","warn","magenta");
sysLogger.log("This line is 'warn' level and color is 'magenta' and appender name is 'Sys'"); sysLogger.log("This line is 'warn' level and color is 'magenta' and appender name is 'Sys'");
``` ```

![Screen Shot](https://raw.github.com/georgeOsdDev/debugUtil/master/ScreenShot.png) ![Screen Shot](https://raw.github.com/georgeOsdDev/debugUtil/master/ScreenShot.png)


### loggingWrap(context,function) ### loggingWrap(context,function)

```javascript ```javascript
function sum(a,b){ function sum(a,b){
return a+b; return a+b;
} }
sum = debugUtil.loggingWrap(this,sum); sum = debugUtil.loggingWrap(this,sum);
sum(1,2); sum(1,2);
``` ```

in your console in your console

``` ```
Start sum Start sum
arguments[0] = 1 arguments[0] = 1
arguments[1] = 2 arguments[1] = 2
result = [3] result = [3]
``` ```

### debugToScreen(String) *client side only ### debugToScreen(String) *client side only

```javascript ```javascript
debugUtil.debugToScreen("message"); debugUtil.debugToScreen("message");
``` ```

message will append to `document.body` and will hide on click. message will append to `document.body` and will hide on click.






## License ## License

Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://creativecommons.org/licenses/MIT/) Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT License](http://creativecommons.org/licenses/MIT/)
<br/>Copyright &copy; 2012 [Takeharu.Oshida](http://georgeosddev.github.com) <br/>Copyright &copy; 2012 [Takeharu.Oshida](http://georgeosddev.github.com)
2 changes: 1 addition & 1 deletion package.json
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
{ {
"name": "debug-util", "name": "debug-util",
"version": "0.1.0", "version": "0.1.1",
"description": "Some debug utility for both server-side and client-side javascript.", "description": "Some debug utility for both server-side and client-side javascript.",
"homepage": "https://github.com/georgeosddev/debugUtil", "homepage": "https://github.com/georgeosddev/debugUtil",
"keywords": [ "keywords": [
Expand Down

0 comments on commit fa6f3de

Please sign in to comment.