Namespace Pot.Debug
Defined in: <pot.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
Debugging utilities.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
Pot.Debug.debug(msg)
Output to the console using log function for debug.
|
<static> |
Pot.Debug.dump(val, (recursiveLimit), (lengthLimit))
Dump and returns all of object as string.
|
<static> |
Pot.Debug.error(msg)
Output to the console using 'error' function for error logging.
|
Method Detail
<static>
{Function}
Pot.Debug.debug(msg)
Output to the console using log function for debug.
debug('hoge'); // hoge
- Parameters:
- {*} msg
- A log message, or variable.
<static>
{Function}
Pot.Debug.dump(val, (recursiveLimit), (lengthLimit))
Dump and returns all of object as string.
var reg = /^[a-z]+$/g; var err = new Error('error!'); var str = new String('hello'); var arr = [1, 2, 3, {a: 4, b: 5, c: true}, false, null, void 0]; var obj = { key1 : 'val1', key2 : 'val2', arr : arr, arr2 : arr, strs : [str, str], err : err, err2 : err, reg1 : reg, reg2 : reg, reg3 : reg }; obj.obj = obj; Pot.debug( Pot.dump(obj) ); // @results // #0 { // key1: "val1", // key2: "val2", // arr: #3 [ // 1, // 2, // 3, // { // a: 4, // b: 5, // c: true // }, // false, // null, // undefined // ], // arr2: #3, // strs: [ // #5 (new String("hello")), // #5 // ], // err: #6 (new Error("error!")), // err2: #6, // reg1: #8 (new RegExp(/^[a-z]+$/g)), // reg2: #8, // reg3: #8, // obj: #0 // }
- Parameters:
- {*} val
- A target object/value.
- {(Number)} (recursiveLimit)
- (Optional) recursive limit. (default = 16)
- {(Number)} (lengthLimit)
- (Optional) length limit. (default = 1024)
- Returns:
- {String} dumped string.
<static>
{Function}
Pot.Debug.error(msg)
Output to the console using 'error' function for error logging.
Pot.error('Error!'); // Error!
- Parameters:
- {*} msg
- An error message, or variable.