beautify-console-log
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -1,2 +0,2 @@ | ||
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var r in o)("object"==typeof exports?exports:t)[r]=o[r]}}(self,(()=>(()=>{var t={155:t=>{var e,o,r=t.exports={};function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(t){if(e===setTimeout)return setTimeout(t,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(o){try{return e.call(null,t,0)}catch(o){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:n}catch(t){e=n}try{o="function"==typeof clearTimeout?clearTimeout:i}catch(t){o=i}}();var a,c=[],l=!1,u=-1;function h(){l&&a&&(l=!1,a.length?c=a.concat(c):u=-1,c.length&&f())}function f(){if(!l){var t=s(h);l=!0;for(var e=c.length;e;){for(a=c,c=[];++u<e;)a&&a[u].run();u=-1,e=c.length}a=null,l=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===i||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{return o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function b(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)e[o-1]=arguments[o];c.push(new d(t,e)),1!==c.length||l||s(f)},d.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=b,r.addListener=b,r.once=b,r.off=b,r.removeListener=b,r.removeAllListeners=b,r.emit=b,r.prependListener=b,r.prependOnceListener=b,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},943:(t,e,o)=>{"use strict";var r=o(155);Object.defineProperty(e,"__esModule",{value:!0}),e.BeautifyConsole=void 0;const n={black:30,red:31,green:32,yellow:33,blue:34,purple:35,cyan:36,white:37},i=(t={})=>{const{color:e="white",colorBg:o=""}=t;return`[${n[o]?n[o]+10:0};${n[e]||0}m`},s=()=>void 0===r?["%cbeautify-console info: -> ","color: #5D8EF0;"]:[i({color:"blue"}),"beautify-console info: -> "],a=()=>void 0===r?["beautify-console error: -> "]:[i({color:"red"}),"beautify-console error: -> "],c=()=>void 0===r?["beautify-console warn: -> "]:[i({color:"yellow"}),"beautify-console warn: -> "],l=()=>void 0===r?["%cbeautify-console log: -> ","color: green;"]:[i({color:"green"}),"beautify-console log: -> "];class u{constructor(){this.infoPadStartText=s(),this.errorPadStartText=a(),this.warnPadStartText=c(),this.logPadStartText=l(),this.info=console.info.bind(this,...this.infoPadStartText),this.error=console.error.bind(this,...this.errorPadStartText),this.warn=console.warn.bind(this,...this.warnPadStartText),this.log=console.log.bind(this,...this.logPadStartText)}static getInstance(){return this.instance||(this.instance=new u),this.instance}setShowLog(t){t?(this.info=console.info.bind(this,...this.infoPadStartText),this.error=console.error.bind(this,...this.errorPadStartText),this.warn=console.warn.bind(this,...this.warnPadStartText),this.log=console.log.bind(this,...this.logPadStartText)):(this.info=(...t)=>{},this.error=(...t)=>{},this.warn=(...t)=>{},this.log=(...t)=>{})}openLog(){return this.setShowLog(!0),this}closeLog(){return this.setShowLog(!1),this}setPadStartText(t,...e){return{info:()=>{this.info=console.info.bind(this,...e)},error:()=>{this.error=console.error.bind(this,...e)},warn:()=>{this.warn=console.warn.bind(this,...e)},log:()=>{this.log=console.log.bind(this,...e)},undefined:()=>{console.log(void 0)}}[t||void 0](),this}}e.BeautifyConsole=u}},e={};function o(r){var n=e[r];if(void 0!==n)return n.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,o),i.exports}var r={};return(()=>{"use strict";var t=r;Object.defineProperty(t,"__esModule",{value:!0}),t.BeautifyConsole=void 0;var e=o(943);Object.defineProperty(t,"BeautifyConsole",{enumerable:!0,get:function(){return e.BeautifyConsole}})})(),r})())); | ||
!function(o,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t=e();for(var r in t)("object"==typeof exports?exports:o)[r]=t[r]}}(self,(()=>(()=>{"use strict";var o={943:(o,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BeautifyConsole=void 0;const t={black:30,red:31,green:32,yellow:33,blue:34,purple:35,cyan:36,white:37},r=(o={})=>{const{color:e="white",colorBg:r=""}=o;return`[${t[r]?t[r]+10:0};${t[e]||0}m`},i=()=>"object"==typeof process?[r({color:"blue"}),"beautify-console-log info: -> "]:["%cbeautify-console-log info: -> ","color: #5D8EF0;"],s=()=>"object"==typeof process?[r({color:"red"}),"beautify-console-log error: -> "]:["beautify-console-log error: -> "],n=()=>"object"==typeof process?[r({color:"yellow"}),"beautify-console-log warn: -> "]:["beautify-console-log warn: -> "],l=()=>"object"==typeof process?[r({color:"green"}),"beautify-console-log log: -> "]:["%cbeautify-console-log log: -> ","color: green;"];class a{constructor(){this.infoPadStartText=i(),this.errorPadStartText=s(),this.warnPadStartText=n(),this.logPadStartText=l(),this.info=console.info.bind(this,...this.infoPadStartText),this.error=console.error.bind(this,...this.errorPadStartText),this.warn=console.warn.bind(this,...this.warnPadStartText),this.log=console.log.bind(this,...this.logPadStartText)}static getInstance(){return this.instance||(this.instance=new a),this.instance}setShowLog(o){o?(this.info=console.info.bind(this,...this.infoPadStartText),this.error=console.error.bind(this,...this.errorPadStartText),this.warn=console.warn.bind(this,...this.warnPadStartText),this.log=console.log.bind(this,...this.logPadStartText)):(this.info=(...o)=>{},this.error=(...o)=>{},this.warn=(...o)=>{},this.log=(...o)=>{})}openLog(){return this.setShowLog(!0),this}closeLog(){return this.setShowLog(!1),this}setPadStartText(o,...e){return{info:()=>{this.info=console.info.bind(this,...e)},error:()=>{this.error=console.error.bind(this,...e)},warn:()=>{this.warn=console.warn.bind(this,...e)},log:()=>{this.log=console.log.bind(this,...e)},undefined:()=>{console.log(void 0)}}[o||void 0](),this}}e.BeautifyConsole=a}},e={};function t(r){var i=e[r];if(void 0!==i)return i.exports;var s=e[r]={exports:{}};return o[r](s,s.exports,t),s.exports}var r={};return(()=>{var o=r;Object.defineProperty(o,"__esModule",{value:!0}),o.BeautifyConsole=void 0;var e=t(943);Object.defineProperty(o,"BeautifyConsole",{enumerable:!0,get:function(){return e.BeautifyConsole}})})(),r})())); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "beautify-console-log", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "This is a further beautification and encapsulation of the 'console' object, including console. log, console. info, console. warn, and console. error.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -9,3 +9,3 @@ #beautify-console-log | ||
You can add custom console printing prefixes and beautify the content (rule reference https://developer.mozilla.org/en-US/docs/Web/API/Console , node environment reference https://en.wikipedia.org/wiki/ANSI_escape_code#Colors), can close console printing at any time | ||
You can add custom console printing prefixes and beautify the content (rule reference https://developer.mozilla.org/en-US/docs/Web/API/Console , node environment reference https://en.wikipedia.org/wiki/ANSI_escape_code#Colors), can close console printing at any time, supporting node.js environments | ||
@@ -12,0 +12,0 @@ |
@@ -5,3 +5,3 @@ # beautify-console-log | ||
这是“console”对象的进一步美化和封装,包括console.log、console.info、console.warn、console.error。 | ||
可以加入自定义的console打印前缀、对内容进行美化(web端规则参考 https://developer.mozilla.org/en-US/docs/Web/API/Console ,node环境参考 https://zh.wikipedia.org/wiki/ANSI%E8%BD%AC%E4%B9%89%E5%BA%8F%E5%88%97),可随时关闭console打印 | ||
可以加入自定义的console打印前缀、对内容进行美化(web端规则参考 https://developer.mozilla.org/en-US/docs/Web/API/Console ,node环境参考 https://zh.wikipedia.org/wiki/ANSI%E8%BD%AC%E4%B9%89%E5%BA%8F%E5%88%97),可随时关闭console打印,支持node环境 | ||
@@ -8,0 +8,0 @@ #### 软件架构 |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
8605
10
1