Comparing version 1.0.0 to 1.0.1
/** | ||
* generator-git - Create the basic scaffolding to start with a git proyect. | ||
* @version v2.0.2 | ||
* @link https://github.com/Kikobeats/generator-git | ||
* acho - A extremely (but powerful) simple logging system for NodeJS and browser. | ||
* @version v1.0.0 | ||
* @link https://github.com/Kikobeats/acho | ||
* @license MIT | ||
*/!function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var a="function"==typeof require&&require;if(!f&&a)return a(i,!0);if(u)return u(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n?n:r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({},{},[]); | ||
*/require=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 p=r[i]={exports:{}};t[i][0].call(p.exports,function(e){var r=t[i][1][e];return o(r?r:e)},p,p.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){"use strict";var r,n,o;n=e("./default"),o=e("chalk"),t.exports=r=function(){function e(e){var t;if(null==e&&(e={}),this.color=null!=e.color?e.color:n.COLOR,this.level=null!=e.level?e.level:n.LEVEL,this.types=null!=e.types?e.types:n.TYPES,this.print=null!=e.print?e.print:n.PRINT,this.muted=null!=e.muted?e.muted:n.MUTED,null!=e.messages)this.messages=e.messages;else{this.messages={};for(t in this.types)this.messages[t]=[]}this.outputType=null!=e.outputType?e.outputType:n.OUTPUT_TYPE,this.outputMessage=null!=e.outputMessage?e.outputMessage:n.OUTPUT_MESSAGE}return e.DEFAULT=n,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.error=function(e){return this.printLine("error",e),this},e.prototype.warning=function(e){return this.printLine("warning",e),this},e.prototype.success=function(e){return this.printLine("success",e),this},e.prototype.info=function(e){return this.printLine("info",e),this},e.prototype.verbose=function(e){return this.printLine("verbose",e),this},e.prototype.debug=function(e){return this.printLine("debug",e),this},e.prototype.silly=function(e){return this.printLine("silly",e),this},e.prototype.isPrintable=function(e){return this.level===this.muted?!1:this.types[e].level<=this.types[this.level].level},e.prototype.colorize=function(e,t){var r,n,s,i;if(!this.color)return t;for(e=e.split(" "),i=o,n=0,s=e.length;s>n;n++)r=e[n],i=i[r];return i(t)},e.prototype.printLine=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),console.log(n+" "+t)},e}()},{"./default":2,chalk:5}],2:[function(e,t){"use strict";t.exports={OUTPUT_TYPE:function(e){return e+" : "},OUTPUT_MESSAGE:function(e){return e},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.printLine(r,e));return s}.call(this));return t},LEVEL:"info",COLOR:!1,MUTED:"silent",TYPES:{line:{color:"gray"},error:{level:0,color:"red"},warning:{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(){},{}],4:[function(e,t){function r(){if(!i){i=!0;for(var e,t=s.length;t;){e=s,s=[];for(var r=-1;++r<t;)e[r]();t=s.length}i=!1}}function n(){}var o=t.exports={},s=[],i=!1;o.nextTick=function(e){s.push(e),i||setTimeout(r,0)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=n,o.addListener=n,o.once=n,o.off=n,o.removeListener=n,o.removeAllListeners=n,o.emit=n,o.binding=function(){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],5:[function(e,t){(function(r){"use strict";function n(e){this.enabled=e&&void 0!==e.enabled?e.enabled:a}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"),p=e("has-ansi"),a=e("supports-color"),f=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=f(function(){},h);f(n.prototype,i()),t.exports=new n,t.exports.styles=l,t.exports.hasColor=p,t.exports.stripColor=c,t.exports.supportsColor=a}).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){"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){"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){"use strict";var r=e("ansi-regex"),n=new RegExp(r().source);t.exports=n.test.bind(n)},{"ansi-regex":9}],9:[function(e,t){"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){"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,r){arguments[4][9][0].apply(r,arguments)},{dup:9}],12:[function(e,t){(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:"UPSTART_JOB"in e.env?!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){"use strict";e("coffee-script/register"),t.exports=e("./lib/Acho")},{"./lib/Acho":1,"coffee-script/register":3}]},{},[]); |
'use strict'; | ||
require('coffee-script').register(); | ||
require('coffee-script/register'); | ||
module.exports = require('./lib/Acho'); |
{ | ||
"name": "acho", | ||
"description": "A extremely (but powerful) simple logging system for NodeJS and browser.", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": { | ||
@@ -26,2 +26,3 @@ "name": "Kiko Beats", | ||
"should": "*", | ||
"vinyl-buffer": "*", | ||
"vinyl-source-stream": "*" | ||
@@ -28,0 +29,0 @@ }, |
@@ -14,11 +14,10 @@ # acho | ||
> A extremely (but powerful) simple logging system for NodeJS and browser. | ||
> An extremely simple (but powerful) logging system for NodeJS and browser. | ||
# Why | ||
* Extremely basic and easy to use, customize and extend. | ||
* Very easy to use, customize and extend. | ||
* Expressive API with chaineable methods. | ||
* Mininum dependencies, just focused in one thing. | ||
* Mininum dependencies, just focussing on one thing. | ||
## Install | ||
@@ -30,3 +29,3 @@ | ||
If you want to use in the browser (powered by [Browserify](http://browserify.org/)): | ||
If you want to use it in the browser (powered by [Browserify](http://browserify.org/)): | ||
@@ -37,3 +36,3 @@ ```bash | ||
and later link in your HTML: | ||
and later add it to your HTML: | ||
@@ -48,3 +47,3 @@ ```html | ||
For use it, basically you need to create a new logger instance. | ||
To use it, you just create a new logger instance. | ||
@@ -63,3 +62,3 @@ ```js | ||
All public methods for use the library are chaineables: | ||
All public methods are chaineables: | ||
@@ -74,3 +73,3 @@ ```js | ||
Maybe you don't want output the message, but store it and for later use it can be a good idea: | ||
Maybe you don't want to output the message, but store it for later use: | ||
@@ -83,3 +82,3 @@ ```js | ||
If you want to print later, just call the method `print`: | ||
If you want to print previously stored messages, just call the method `print`: | ||
@@ -91,3 +90,3 @@ ```js | ||
At this moment maybe you are thinking: Can I combine print the message with store the message? Absolutely! | ||
You might be thinking: Can I combine both, to store and both print a message? Absolutely! | ||
@@ -101,3 +100,3 @@ ```js | ||
You also can redefine the print method, not exist limits! | ||
You can also modify the print method! | ||
@@ -119,20 +118,19 @@ ```js | ||
Do whatever you need for adapt the library of yours requisites: changes colors, add more types, sort the priorities... the internal structure of the object is public and you can edit dynamically. **You have the power**. | ||
You can completely customize the library to your requirements: changes colors, add more types, sort the priorities... the internal structure of the object is public and you can edit it dynamically. **You have the power**. | ||
### Defining the level | ||
### Stablish the level | ||
Establishing the loglevel is a good way to filter out undesired information from output. The available levels are: | ||
Stablishing the level of your logs is a good way to avoid some information that maybe you don't want to output. The error levels are: | ||
- `error`: Display calls to `.error()` messages. | ||
- `warning`: Display calls from `.error()`, `.warning()` messages. | ||
- `success`: Display calls from `.error()`, `.warning()`, `success()` messages. | ||
- `info`: Display calls from `.error()`, `.warning()`, `success()`, `info()` messages. | ||
- `verbose`: Display calls from `.error()`, `.warning()`, `success()`, `info()`, `verbose()` messages. | ||
- `debug`: Display calls from `.error()`, `.warning()`, `success()`, `info()`, `verbose()`, `debug()` messages. | ||
- `silly`: Display calls from `.error()`, `.warning()`, `success()`, `info()`, `verbose()`, `debug()`, `silly()` messages. | ||
- `silent`: Avoid all output. | ||
- `error`: Display calls to `.error() messages`. | ||
- `warning`: Display calls from `.error()`, `.warning() messages`. | ||
- `success`: Display calls from `.error()`, `.warning(), `success()` messages`. | ||
- `info`: Display calls from `.error()`, `.warning(), `success()`, `info()` messages`. | ||
- `verbose`: Display calls from `.error()`, `.warning(), `success()` `info()`, `verbose()` messages`. | ||
- `debug`: Display calls from `.error()`, `.warning(), `success()` `info()`, `verbose()` `debug()` messages`. | ||
- `silly`: Display calls from `.error()`, `.warning(), `success()` `info()`, `verbose()` `debug()` `silly()` messages` | ||
- `silent`: Avoid all. | ||
The default log level is `info`. You can define it in the the constructor: | ||
The default log level is `info`. You can do it in the the constructor: | ||
```js | ||
@@ -142,3 +140,3 @@ var acho = new Acho({level: 'silly'}) | ||
or in any time: | ||
or at runtime: | ||
@@ -151,7 +149,7 @@ ```js | ||
By default the messages structure is minimal: Just the message type followed by the content of the message. | ||
By default the messages structure is brief: Just the message type followed by the message itself. | ||
But you can easily customize it, for example, adding an timestamp for each message. | ||
But you can easily modify the output. For example, let's add a timestamp to each message. | ||
For do it, we offer two methods, `outputType` and `outputMessage`: | ||
To customize the output we offer two methods, `outputType` and `outputMessage`: | ||
@@ -172,10 +170,10 @@ ```js | ||
Now is moment to your awesome output: | ||
This results in your awesome output: | ||
```js | ||
acho.info('I have hungry'); | ||
// => '[ info ] » Fri Mar 13 2015 18:12:48 GMT+0100 (CET) :: I have hungry' | ||
acho.info('I am hungry'); | ||
// => '[ info ] » Fri Mar 13 2015 18:12:48 GMT+0100 (CET) :: I am hungry' | ||
``` | ||
You can change how to output the message in the constructor or in any time. | ||
You can modify the outputted message at any time. | ||
@@ -187,18 +185,18 @@ | ||
Create a new logger. The options that you can provide are: | ||
Create a new logger. Available options: | ||
- color **{Boolean}**: If you can colorize the otuput. `false` by default. | ||
- level **{String}**: Stablish the logging level. `info` by default. | ||
- color **{Boolean}**: Enable or disable colorized output. `false` by default. | ||
- level **{String}**: Provide the logging level. `info` by default. | ||
- types **{Object}**: You can provide the types and priorities. | ||
- outputType **{Function}**: For customize the type in the output. | ||
- outputMessage **{Function}**: For customize the message in the output. | ||
- print **{Function}**: Provide a function for print the messages. | ||
- outputType **{Function}**: Provide a function to customize the type in the output. | ||
- outputMessage **{Function}**: Provide a function to customize the message in the output. | ||
- print **{Function}**: Provide a function to print the messages. | ||
### .push({String} <type>, {String} <message>) | ||
Store internally a `type` message. | ||
Store a message of given `type` internally. | ||
### .add({String} <type>, {String} <message>) | ||
Store internally a `type` message and also output it. | ||
Store a message of given `type` internally and also output it. | ||
@@ -243,7 +241,7 @@ ### .error({String} <message>) | ||
Combine `.isPrintable` and `.colorize` for print a line correctly. | ||
Combine `.isPrintable` and `.colorize` to print a line correctly. | ||
### .print() | ||
Default loop for print the messages that are stored internally. By default uses `.printLine` in each message iteration. | ||
Default loop to print the messages that are stored internally. By default it uses `.printLine` in each message iteration. | ||
@@ -250,0 +248,0 @@ ## License |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
25361
19
10
236