Comparing version 2.0.0 to 2.1.0
{ | ||
"name": "acho", | ||
"description": "An extremely simple (but powerful) logging system for NodeJS and browser.", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"authors": [ | ||
@@ -6,0 +6,0 @@ "Kiko Beats josefrancisco.verdu@gmail.com" |
@@ -0,1 +1,20 @@ | ||
<a name="2.1.0"></a> | ||
# 2.1.0 (2015-08-17) | ||
* added generateTypeMessage as external parameter. | ||
([a0f67f3](https://github.com/kikobeats/acho/commit/a0f67f3)) | ||
* Added transport option | ||
([a1170e3](https://github.com/kikobeats/acho/commit/a1170e3)) | ||
* fixed production check | ||
([af63da9](https://github.com/kikobeats/acho/commit/af63da9)) | ||
* Improve production comparation | ||
([eee1281](https://github.com/kikobeats/acho/commit/eee1281)) | ||
* updated | ||
([ca112ba](https://github.com/kikobeats/acho/commit/ca112ba)) | ||
* updated | ||
([ad532e2](https://github.com/kikobeats/acho/commit/ad532e2)) | ||
<a name="2.0.0"></a> | ||
@@ -5,2 +24,4 @@ # 2.0.0 (2015-07-31) | ||
* 2.0.0 releases | ||
([0daf159](https://github.com/kikobeats/acho/commit/0daf159)) | ||
* avoid avoid colorize messages in production under NodeJS | ||
@@ -7,0 +28,0 @@ ([f6d2d54](https://github.com/kikobeats/acho/commit/f6d2d54)) |
/** | ||
* acho - An extremely simple (but powerful) logging system for NodeJS and browser. | ||
* @version v2.0.0 | ||
* @version v2.1.0 | ||
* @link https://github.com/Kikobeats/acho | ||
* @license MIT | ||
*/!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Acho=e()}}(function(){return function e(t,n,r){function o(i,u){if(!n[i]){if(!t[i]){var c="function"==typeof require&&require;if(!u&&c)return c(i,!0);if(s)return s(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var a=n[i]={exports:{}};t[i][0].call(a.exports,function(e){var n=t[i][1][e];return o(n?n:e)},a,a.exports,e,t,n,r)}return n[i].exports}for(var s="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,t,n){(function(n){"use strict";var r,o,s,i=function(e,t){return function(){return e.apply(t,arguments)}};s=e("chalk"),o=e("./Default"),t.exports=r=function(){function e(e){null==e&&(e={}),this.generateTypeMessage=i(this.generateTypeMessage,this),this.color=e.color||o.COLOR,this.level=e.level||o.UNMUTED,this.types=e.types||o.TYPES,this.print=e.print||o.PRINT,this.messages=function(t){return function(){var n,r,o;n={};for(o in t.types)n[o]=(null!=(r=e.messages)?r[o]:void 0)||[],"line"!==o&&(t[o]=t.generateTypeMessage(o));return n}}(this)(),this.outputType=e.outputType||o.OUTPUT_TYPE,this.outputMessage=e.outputMessage||o.OUTPUT_MESSAGE,this.generateMessage=e.generateMessage||o.GENERATE_MESSAGE}return e.prototype.push=function(e,t){return this.messages[e].push(t),this},e.prototype.add=function(e,t){return this[e](t),this.push(e,t),this},e.prototype.colorize=function(e,t){var r,o,i,u;if(!this.color||"production"===("undefined"!=typeof n&&null!==n?n.env.NODE_ENV:void 0))return t;for(e=e.split(" "),u=s,o=0,i=e.length;i>o;o++)r=e[o],u=u[r];return u(t)},e.prototype.isPrintable=function(e){return this.level===o.UNMUTED?!0:this.level===o.MUTED?!1:this.types[e].level<=this.types[this.level].level},e.prototype.generateTypeMessage=function(e,t){return function(t){return function(n){return console.log(t.generateMessage(e,n)),t}}(this)},e}()}).call(this,e("_process"))},{"./Default":2,_process:4,chalk:5}],2:[function(e,t,n){"use strict";t.exports={PRINT:function(){var e,t,n;t=[];for(n in this.types)t.push(function(){var t,r,o,s;for(o=this.messages[n],s=[],t=0,r=o.length;r>t;t++)e=o[t],s.push(console.log(this.generateMessage(n,e)));return s}.call(this));return t},OUTPUT_MESSAGE:function(e){return e},OUTPUT_TYPE:function(e){return e+" : "},GENERATE_MESSAGE:function(e,t){var n,r;if(this.isPrintable(e))return n=this.types[e].color,r=this.outputType(e),r=this.colorize(n,r),t=this.outputMessage(t),t=this.colorize(this.types.line.color,t),r+t},COLOR:!0,UNMUTED:"all",MUTED:"silent",TYPES:{line:{color:"gray"},error:{level:0,color:"red"},warn:{level:1,color:"yellow"},success:{level:2,color:"green"},info:{level:3,color:"white"},verbose:{level:4,color:"cyan"},debug:{level:5,color:"blue"},silly:{level:6,color:"magenta"}}}},{}],3:[function(e,t,n){},{}],4:[function(e,t,n){function r(){a=!1,u.length?l=u.concat(l):f=-1,l.length&&o()}function o(){if(!a){var e=setTimeout(r);a=!0;for(var t=l.length;t;){for(u=l,l=[];++f<t;)u[f].run();f=-1,t=l.length}u=null,a=!1,clearTimeout(e)}}function s(e,t){this.fun=e,this.array=t}function i(){}var u,c=t.exports={},l=[],a=!1,f=-1;c.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new s(e,t)),1!==l.length||a||setTimeout(o,0)},s.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=i,c.addListener=i,c.once=i,c.off=i,c.removeListener=i,c.removeAllListeners=i,c.emit=i,c.binding=function(e){throw new Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(e){throw new Error("process.chdir is not supported")},c.umask=function(){return 0}},{}],5:[function(e,t,n){(function(n){"use strict";function r(e){this.enabled=e&&void 0!==e.enabled?e.enabled:f}function o(e){var t=function n(){return s.apply(n,arguments)};return t._styles=e,t.enabled=this.enabled,t.__proto__=h,t}function s(){var e=arguments,t=e.length,n=0!==t&&String(arguments[0]);if(t>1)for(var r=1;t>r;r++)n+=" "+e[r];if(!this.enabled||!n)return n;for(var o=this._styles,s=o.length;s--;){var i=c[o[s]];n=i.open+n.replace(i.closeRe,i.open)+i.close}return n}function i(){var e={};return Object.keys(g).forEach(function(t){e[t]={get:function(){return o.call(this,[t])}}}),e}var u=e("escape-string-regexp"),c=e("ansi-styles"),l=e("strip-ansi"),a=e("has-ansi"),f=e("supports-color"),p=Object.defineProperties;"win32"===n.platform&&(c.blue.open="[94m");var g=function(){var e={};return Object.keys(c).forEach(function(t){c[t].closeRe=new RegExp(u(c[t].close),"g"),e[t]={get:function(){return o.call(this,this._styles.concat(t))}}}),e}(),h=p(function(){},g);p(r.prototype,i()),t.exports=new r,t.exports.styles=c,t.exports.hasColor=a,t.exports.stripColor=l,t.exports.supportsColor=f}).call(this,e("_process"))},{_process:4,"ansi-styles":6,"escape-string-regexp":7,"has-ansi":8,"strip-ansi":10,"supports-color":12}],6:[function(e,t,n){"use strict";var r=t.exports={modifiers:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},colors:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39]},bgColors:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49]}};r.colors.grey=r.colors.gray,Object.keys(r).forEach(function(e){var t=r[e];Object.keys(t).forEach(function(e){var n=t[e];r[e]=t[e]={open:"["+n[0]+"m",close:"["+n[1]+"m"}}),Object.defineProperty(r,e,{value:t,enumerable:!1})})},{}],7:[function(e,t,n){"use strict";var r=/[|\\{}()[\]^$+*?.]/g;t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(r,"\\$&")}},{}],8:[function(e,t,n){"use strict";var r=e("ansi-regex"),o=new RegExp(r().source);t.exports=o.test.bind(o)},{"ansi-regex":9}],9:[function(e,t,n){"use strict";t.exports=function(){return/(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/g}},{}],10:[function(e,t,n){"use strict";var r=e("ansi-regex")();t.exports=function(e){return"string"==typeof e?e.replace(r,""):e}},{"ansi-regex":11}],11:[function(e,t,n){arguments[4][9][0].apply(n,arguments)},{dup:9}],12:[function(e,t,n){(function(e){"use strict";var n=e.argv;t.exports=function(){return"FORCE_COLOR"in e.env?!0:-1!==n.indexOf("--no-color")||-1!==n.indexOf("--no-colors")||-1!==n.indexOf("--color=false")?!1:-1!==n.indexOf("--color")||-1!==n.indexOf("--colors")||-1!==n.indexOf("--color=true")||-1!==n.indexOf("--color=always")?!0:e.stdout&&!e.stdout.isTTY?!1:"win32"===e.platform?!0:"COLORTERM"in e.env?!0:"dumb"===e.env.TERM?!1:/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(e.env.TERM)?!0:!1}()}).call(this,e("_process"))},{_process:4}],Acho:[function(e,t,n){"use strict";e("coffee-script/register"),t.exports=e("./lib/Acho")},{"./lib/Acho":1,"coffee-script/register":3}]},{},[])("Acho")}); | ||
*/!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Acho=e()}}(function(){return function e(t,r,n){function o(i,u){if(!r[i]){if(!t[i]){var l="function"==typeof require&&require;if(!u&&l)return l(i,!0);if(s)return s(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var a=r[i]={exports:{}};t[i][0].call(a.exports,function(e){var r=t[i][1][e];return o(r?r:e)},a,a.exports,e,t,r,n)}return r[i].exports}for(var s="function"==typeof require&&require,i=0;i<n.length;i++)o(n[i]);return o}({1:[function(e,t,r){(function(r){"use strict";var n,o,s;s=e("chalk"),o=e("./Default"),t.exports=n=function(){function e(e){null==e&&(e={}),this.color=e.color||o.COLOR,this.level=e.level||o.UNMUTED,this.types=e.types||o.TYPES,this.transport=e.transport||o.TRANSPORT,this.outputType=e.outputType||o.OUTPUT_TYPE,this.outputMessage=e.outputMessage||o.OUTPUT_MESSAGE,this.generateMessage=e.generateMessage||o.GENERATE_MESSAGE,this.generateTypeMessage=e.generateTypeMessage||o.GENERATE_TYPE_MESSAGE,this.print=e.print||o.PRINT,this.messages=function(t){return function(){var r,n,o;r={};for(o in t.types)r[o]=(null!=(n=e.messages)?n[o]:void 0)||[],"line"!==o&&(t[o]=t.generateTypeMessage(o));return r}}(this)()}return e.prototype.push=function(e,t){return this.messages[e].push(t),this},e.prototype.add=function(e,t){return this[e](t),this.push(e,t),this},e.prototype.colorize=function(e,t){var n,o,i,u,l;if(!this.color||"production"===("undefined"!=typeof r&&null!==r&&null!=(u=r.env.NODE_ENV)?u.toLowerCase():void 0))return t;for(e=e.split(" "),l=s,o=0,i=e.length;i>o;o++)n=e[o],l=l[n];return l(t)},e.prototype.isPrintable=function(e){return this.level===o.UNMUTED?!0:this.level===o.MUTED?!1:this.types[e].level<=this.types[this.level].level},e}()}).call(this,e("_process"))},{"./Default":2,_process:4,chalk:5}],2:[function(e,t,r){"use strict";t.exports={PRINT:function(){var e,t,r;t=[];for(r in this.types)t.push(function(){var t,n,o,s;for(o=this.messages[r],s=[],t=0,n=o.length;n>t;t++)e=o[t],s.push(this.transport(this.generateMessage(r,e)));return s}.call(this));return t},OUTPUT_MESSAGE:function(e){return e},OUTPUT_TYPE:function(e){return e+" : "},TRANSPORT:console.log,GENERATE_MESSAGE:function(e,t){var r,n;if(this.isPrintable(e))return r=this.types[e].color,n=this.outputType(e),n=this.colorize(r,n),t=this.outputMessage(t),t=this.colorize(this.types.line.color,t),n+t},GENERATE_TYPE_MESSAGE:function(e){return function(t){return this.transport(this.generateMessage(e,t)),this}},COLOR:!0,UNMUTED:"all",MUTED:"silent",TYPES:{line:{color:"gray"},error:{level:0,color:"red"},warn:{level:1,color:"yellow"},success:{level:2,color:"green"},info:{level:3,color:"white"},verbose:{level:4,color:"cyan"},debug:{level:5,color:"blue"},silly:{level:6,color:"magenta"}}}},{}],3:[function(e,t,r){},{}],4:[function(e,t,r){function n(){a=!1,u.length?c=u.concat(c):f=-1,c.length&&o()}function o(){if(!a){var e=setTimeout(n);a=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u[f].run();f=-1,t=c.length}u=null,a=!1,clearTimeout(e)}}function s(e,t){this.fun=e,this.array=t}function i(){}var u,l=t.exports={},c=[],a=!1,f=-1;l.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new s(e,t)),1!==c.length||a||setTimeout(o,0)},s.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=i,l.addListener=i,l.once=i,l.off=i,l.removeListener=i,l.removeAllListeners=i,l.emit=i,l.binding=function(e){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(e){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},{}],5:[function(e,t,r){(function(r){"use strict";function n(e){this.enabled=e&&void 0!==e.enabled?e.enabled:f}function o(e){var t=function r(){return s.apply(r,arguments)};return t._styles=e,t.enabled=this.enabled,t.__proto__=g,t}function s(){var e=arguments,t=e.length,r=0!==t&&String(arguments[0]);if(t>1)for(var n=1;t>n;n++)r+=" "+e[n];if(!this.enabled||!r)return r;for(var o=this._styles,s=o.length;s--;){var i=l[o[s]];r=i.open+r.replace(i.closeRe,i.open)+i.close}return r}function i(){var e={};return Object.keys(h).forEach(function(t){e[t]={get:function(){return o.call(this,[t])}}}),e}var u=e("escape-string-regexp"),l=e("ansi-styles"),c=e("strip-ansi"),a=e("has-ansi"),f=e("supports-color"),p=Object.defineProperties;"win32"===r.platform&&(l.blue.open="[94m");var h=function(){var e={};return Object.keys(l).forEach(function(t){l[t].closeRe=new RegExp(u(l[t].close),"g"),e[t]={get:function(){return o.call(this,this._styles.concat(t))}}}),e}(),g=p(function(){},h);p(n.prototype,i()),t.exports=new n,t.exports.styles=l,t.exports.hasColor=a,t.exports.stripColor=c,t.exports.supportsColor=f}).call(this,e("_process"))},{_process:4,"ansi-styles":6,"escape-string-regexp":7,"has-ansi":8,"strip-ansi":10,"supports-color":12}],6:[function(e,t,r){"use strict";var n=t.exports={modifiers:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},colors:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39]},bgColors:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49]}};n.colors.grey=n.colors.gray,Object.keys(n).forEach(function(e){var t=n[e];Object.keys(t).forEach(function(e){var r=t[e];n[e]=t[e]={open:"["+r[0]+"m",close:"["+r[1]+"m"}}),Object.defineProperty(n,e,{value:t,enumerable:!1})})},{}],7:[function(e,t,r){"use strict";var n=/[|\\{}()[\]^$+*?.]/g;t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(n,"\\$&")}},{}],8:[function(e,t,r){"use strict";var n=e("ansi-regex"),o=new RegExp(n().source);t.exports=o.test.bind(o)},{"ansi-regex":9}],9:[function(e,t,r){"use strict";t.exports=function(){return/(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/g}},{}],10:[function(e,t,r){"use strict";var n=e("ansi-regex")();t.exports=function(e){return"string"==typeof e?e.replace(n,""):e}},{"ansi-regex":11}],11:[function(e,t,r){arguments[4][9][0].apply(r,arguments)},{dup:9}],12:[function(e,t,r){(function(e){"use strict";var r=e.argv;t.exports=function(){return"FORCE_COLOR"in e.env?!0:-1!==r.indexOf("--no-color")||-1!==r.indexOf("--no-colors")||-1!==r.indexOf("--color=false")?!1:-1!==r.indexOf("--color")||-1!==r.indexOf("--colors")||-1!==r.indexOf("--color=true")||-1!==r.indexOf("--color=always")?!0:e.stdout&&!e.stdout.isTTY?!1:"win32"===e.platform?!0:"COLORTERM"in e.env?!0:"dumb"===e.env.TERM?!1:/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(e.env.TERM)?!0:!1}()}).call(this,e("_process"))},{_process:4}],Acho:[function(e,t,r){"use strict";e("coffee-script/register"),t.exports=e("./lib/Acho")},{"./lib/Acho":1,"coffee-script/register":3}]},{},[])("Acho")}); |
{ | ||
"name": "acho", | ||
"version": "2.0.0", | ||
"description": "An extremely simple (but powerful) logging system for NodeJS and browser.", | ||
"homepage": "https://github.com/Kikobeats/acho", | ||
"version": "2.1.0", | ||
"main": "./index.js", | ||
"author": { | ||
"email": "josefrancisco.verdu@gmail.com", | ||
"name": "Kiko Beats", | ||
"email": "josefrancisco.verdu@gmail.com", | ||
"url": "https://github.com/Kikobeats" | ||
}, | ||
"scripts": { | ||
"test": "sh test/test.sh", | ||
"build": "node ./node_modules/.bin/gulp --require coffee-script" | ||
}, | ||
"main": "./index.js", | ||
"repository": "Kikobeats/acho", | ||
@@ -21,4 +18,4 @@ "bugs": { | ||
"log", | ||
"logging", | ||
"logger" | ||
"logger", | ||
"logging" | ||
], | ||
@@ -42,7 +39,10 @@ "dependencies": { | ||
}, | ||
"license": "MIT", | ||
"engines": { | ||
"node": "*" | ||
}, | ||
"homepage": "https://github.com/Kikobeats/acho" | ||
"scripts": { | ||
"build": "node ./node_modules/.bin/gulp --require coffee-script", | ||
"test": "sh test/test.sh" | ||
}, | ||
"license": "MIT" | ||
} |
@@ -179,10 +179,38 @@ # acho | ||
- color **{Boolean}**: Enable or disable colorized output. `false` by default. | ||
- level **{String}**: Provides the logging level. `all` by default. | ||
- types **{Object}**: You can provide the types and priorities. | ||
- print **{Function}**: Provides a function that determines how to print the messages. By default uses `.generateMessage` for generate the mesage that will be outputted. | ||
- outputType **{Function}**: Provides a function to customize the type in the output. | ||
- outputMessage **{Function}**: Provides a function to customize the message in the output. | ||
- generateMessage **{Function}**: Provides a function that generate the message to be outputted. It combines other internal methods for generate the output (as `.isPrintable` or `.colorize`) and normally you are not interested in the definition of it, but you can provide it as option as well. | ||
#### color **{Boolean}** | ||
Enable or disable colorized output. `false` by default. | ||
#### level **{String}** | ||
Provides the logging level. `all` by default. | ||
#### types **{Object}** | ||
You can provide the types and priorities. | ||
#### print **{Function}** | ||
Provides a function that determines how to print the messages. By default uses `.generateMessage` for generate the mesage that will be outputted. | ||
#### transport **{Function}** | ||
Defines what happens with the log message. By default is `console.log`. | ||
#### outputType **{Function}** | ||
Provides a function to customize the type in the output. | ||
#### outputMessage **{Function}** | ||
Provides a function to customize the message in the output. | ||
#### generateMessage **{Function}** | ||
Provides a function that generate the message to be outputted. It combines other internal methods for generate the output (as `.isPrintable` or `.colorize`) and normally you are not interested in the definition of it, but you can provide it as option as well. | ||
#### generateTypeMessage **{Function}** | ||
Provides a function used to generate the type message. | ||
### .push({String} <type>, {String} <message>) | ||
@@ -198,2 +226,6 @@ | ||
### .print() | ||
Prints all messages internally stored. | ||
### .\[loglevel\]({String} <message>) | ||
@@ -203,12 +235,4 @@ | ||
### .isPrintable({String} <type>) | ||
Determines if a type of message should be outputted. | ||
### .colorize({String} <color> {String} <message>) | ||
Determines is a instance of `acho` is outputted with colors. | ||
## License | ||
MIT © [Kiko Beats](http://www.kikobeats.com) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33415
236