fancy-node-logger
Advanced tools
Comparing version 0.0.8 to 0.1.0
@@ -1,1 +0,1 @@ | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),Type=require("./Type"),chalk=require("chalk"),FancyNodeLogger=function e(){var i=this;(0,_classCallCheck2.default)(this,e),(0,_defineProperty2.default)(this,"parseMessages",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];switch(null==t?void 0:t.length){case 1:return[t[0]];case 2:return[t[0],null,t[1]];case 3:return[t[0],t[1],t[2]];default:return[]}}),(0,_defineProperty2.default)(this,"getDefaultSeverityStyle",function(e){switch(e){case Type.VERBOSE:return["bgWhite","black"];case Type.INFO:return["bgBlueBright","black"];case Type.SUCCESS:return["bgGreenBright","black"];case Type.WARNING:return["bgYellowBright","black"];case Type.ERROR:return["bgRedBright","black"];default:return["bgWhite","black"]}}),(0,_defineProperty2.default)(this,"getDefaultTitleStyle",function(e){switch(e){case Type.VERBOSE:return["white"];case Type.INFO:return["blueBright"];case Type.SUCCESS:return["greenBright"];case Type.WARNING:return["yellowBright"];case Type.ERROR:return["redBright"];default:return["white"]}}),(0,_defineProperty2.default)(this,"formatText",function(e,t){if(!e)return"";if(!t||(null==t?void 0:t.length)<1)return e;var r=chalk;return null!=t&&t.forEach(function(e){return r=null===r||void 0===r?void 0:r[e]}),r?r("",e,""):e}),(0,_defineProperty2.default)(this,"print",function(e,t,r,n,a,u){t=i.formatText(e,t),t=t?"".concat(t," "):"",r=i.formatText(r,n),n=r?"".concat(r," "):"",u=i.formatText(a,u),u=u?"".concat(r?"\n":"").concat(u,"\n"):"";console.log("".concat(t).concat(n).concat(u))}),(0,_defineProperty2.default)(this,"output",function(e){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var a=i.parseMessages.apply(i,r),u=(0,_slicedToArray2.default)(a,3),o=u[0],a=u[1],u=u[2];i.print(o,i.getDefaultSeverityStyle(e),a,i.getDefaultTitleStyle(e),u)}),(0,_defineProperty2.default)(this,"note",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.output.apply(i,[Type.VERBOSE,"NOTE"].concat(t))}),(0,_defineProperty2.default)(this,"verbose",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.output.apply(i,[Type.VERBOSE,"VERBOSE"].concat(t))}),(0,_defineProperty2.default)(this,"info",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.output.apply(i,[Type.INFO,"INFO"].concat(t))}),(0,_defineProperty2.default)(this,"wait",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.output.apply(i,[Type.INFO,"WAIT"].concat(t))}),(0,_defineProperty2.default)(this,"success",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.output.apply(i,[Type.SUCCESS,"SUCCESS"].concat(t))}),(0,_defineProperty2.default)(this,"done",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.output.apply(i,[Type.SUCCESS,"DONE"].concat(t))}),(0,_defineProperty2.default)(this,"warning",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.output.apply(i,[Type.WARNING,"WARNING"].concat(t))}),(0,_defineProperty2.default)(this,"issue",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.output.apply(i,[Type.WARNING,"ISSUE"].concat(t))}),(0,_defineProperty2.default)(this,"error",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.output.apply(i,[Type.ERROR,"ERROR"].concat(t))}),(0,_defineProperty2.default)(this,"failure",function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];i.output.apply(i,[Type.ERROR,"FAILURE"].concat(t))})},fancyNodeLogger=new FancyNodeLogger;fancyNodeLogger.Type=Type,module.exports=fancyNodeLogger; | ||
"use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault"),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),Type=require("./Type"),chalk=require("chalk"),FancyNodeLogger=function e(){var i=this;(0,_classCallCheck2.default)(this,e),(0,_defineProperty2.default)(this,"parseMessages",function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];switch(null==r?void 0:r.length){case 1:return[r[0]];case 2:return[r[0],null,r[1]];case 3:return[r[0],r[1],r[2]];default:return[]}}),(0,_defineProperty2.default)(this,"getDefaultSeverityStyle",function(e){switch(e){case Type.VERBOSE:return["bgWhite","black"];case Type.INFO:return["bgBlueBright","black"];case Type.SUCCESS:return["bgGreenBright","black"];case Type.WARNING:return["bgYellowBright","black"];case Type.ERROR:return["bgRedBright","black"];default:return["bgWhite","black"]}}),(0,_defineProperty2.default)(this,"getDefaultTitleStyle",function(e){switch(e){case Type.VERBOSE:return["white"];case Type.INFO:return["blueBright"];case Type.SUCCESS:return["greenBright"];case Type.WARNING:return["yellowBright"];case Type.ERROR:return["redBright"];default:return["white"]}}),(0,_defineProperty2.default)(this,"formatText",function(e,r){if(!e)return"";if(!r||(null==r?void 0:r.length)<1)return e;var t=chalk;return null!=r&&r.forEach(function(e){return t=null===t||void 0===t?void 0:t[e]}),t?t("",e,""):e}),(0,_defineProperty2.default)(this,"print",function(e,r,t,n,a,u){r=i.formatText(e,r),r=r?"".concat(r," "):"",t=i.formatText(t,n),n=t?"".concat(t," "):"",u=i.formatText(a,u),u=u?"".concat(t?"\n":"").concat(u,"\n"):"";console.log("".concat(r).concat(n).concat(u))}),(0,_defineProperty2.default)(this,"output",function(e){for(var r=arguments.length,t=new Array(1<r?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];var a=i.parseMessages.apply(i,t),u=(0,_slicedToArray2.default)(a,3),o=u[0],a=u[1],u=u[2];i.print(o,i.getDefaultSeverityStyle(e),a,i.getDefaultTitleStyle(e),u)}),(0,_defineProperty2.default)(this,"createLogger",function(n,a){return function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return i.output.apply(i,[n,a].concat(r))}}),(0,_defineProperty2.default)(this,"registLogger",function(e,r){return i[e]=r}),(0,_defineProperty2.default)(this,"verbose",function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return i.output.apply(i,[Type.VERBOSE,"VERBOSE"].concat(r)),i}),(0,_defineProperty2.default)(this,"note",function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return i.output.apply(i,[Type.VERBOSE,"NOTE"].concat(r)),i}),(0,_defineProperty2.default)(this,"info",function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return i.output.apply(i,[Type.INFO,"INFO"].concat(r)),i}),(0,_defineProperty2.default)(this,"wait",function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return i.output.apply(i,[Type.INFO,"WAIT"].concat(r)),i}),(0,_defineProperty2.default)(this,"success",function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return i.output.apply(i,[Type.SUCCESS,"SUCCESS"].concat(r)),i}),(0,_defineProperty2.default)(this,"done",function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return i.output.apply(i,[Type.SUCCESS,"DONE"].concat(r)),i}),(0,_defineProperty2.default)(this,"warning",function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return i.output.apply(i,[Type.WARNING,"WARNING"].concat(r)),i}),(0,_defineProperty2.default)(this,"issue",function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return i.output.apply(i,[Type.WARNING,"ISSUE"].concat(r)),i}),(0,_defineProperty2.default)(this,"error",function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return i.output.apply(i,[Type.ERROR,"ERROR"].concat(r)),i}),(0,_defineProperty2.default)(this,"failure",function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return i.output.apply(i,[Type.ERROR,"FAILURE"].concat(r)),i})},fancyNodeLogger=new FancyNodeLogger;fancyNodeLogger.Type=Type,module.exports=fancyNodeLogger; |
{ | ||
"name": "fancy-node-logger", | ||
"author": "liangxiaojun", | ||
"version": "0.0.8", | ||
"version": "0.1.0", | ||
"description": "Fancy logger in Node with Chalk", | ||
@@ -13,3 +13,3 @@ "main": "./dist/index.js", | ||
"scripts": { | ||
"example": "node examples/advanced.js", | ||
"example": "node examples/customized.js", | ||
"build": "gulp build", | ||
@@ -16,0 +16,0 @@ "do-publish": "npm run build && npm publish" |
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
6830