logalize 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -17
- data/lib/logalize/rails/version.rb +1 -1
- data/vendor/assets/javascripts/logalize.js +1 -1
- metadata +4 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bff28efe0ad5f39b06c69bcbb57396d479caccf
|
4
|
+
data.tar.gz: 9ea937fd85e809cbecff9e5025706263649679d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac639e239364611c97ea06e1d6ac53141865a888e84e20fb288e4edc7fd5e08d314f7282f9325674af1929c6a7fe9b1dbf9efe8a022286ffeefc5cbe50780919
|
7
|
+
data.tar.gz: 94234a52b40a82f8dcb0b78c116082e907198c76e27e147fa53eb27e88d574913f4a6cd81bf0a366938cd62dd55d7f72ac723f2a7e0e114190dfd3b01ba490e6
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Logalize
|
2
2
|
|
3
|
-
Logalize is a
|
4
|
-
|
3
|
+
Logalize is a JavaScript wrapper for browser's developer console.
|
5
4
|
This is a Rails gem version of the library. For source files and an npm package, go [here](https://github.com/akxcv/logalize).
|
6
5
|
|
7
6
|
## Installation
|
@@ -22,10 +21,6 @@ Add this to your `application.js`:
|
|
22
21
|
- [Namespaces](#namespaces).
|
23
22
|
- [Markdown-like formatting](#formatting).
|
24
23
|
|
25
|
-
## Browser support
|
26
|
-
|
27
|
-
TBD
|
28
|
-
|
29
24
|
## Usage
|
30
25
|
|
31
26
|
Enable or disable logging:
|
@@ -86,18 +81,21 @@ logalize.log('my output')
|
|
86
81
|
logalize.configure({
|
87
82
|
enabled: true,
|
88
83
|
enableFormatting: true,
|
89
|
-
|
84
|
+
enableConsoleHooks: true,
|
85
|
+
collapseNamespaces: false
|
90
86
|
})
|
91
87
|
```
|
92
88
|
- `enabled`: Defines whether to enable or disable Logalize.
|
93
89
|
When Logalize is disabled, it will not produce any output. However, lambda versions of `profile`, `time`, `group` and `namespace`
|
94
90
|
will still execute given functions. Default: `true`.
|
95
91
|
- `enableFormatting`: Defines whether [formatting](#formatting) should be enabled. Default: `true`.
|
96
|
-
- `
|
92
|
+
- `enableConsoleHooks`: Defines whether Logalize needs to modify `console`.
|
97
93
|
Generally, modifying global objects is a bad thing to do, but this is required if you want Logalize to
|
98
94
|
handle console output correctly. Logalize is modifying `console` functions *very carefully* (it just
|
99
95
|
needs to hook to those methods). You can safely disable this options, but regular console output
|
100
96
|
will occasionally get stuck inside groups it does not belong to. see [known issues](#known-issues). Default: `true`.
|
97
|
+
- `collapseNamespaces`: Defines whether [namespaces](#namespaces) should use `group` or `groupCollapsed` method.
|
98
|
+
Defaults to `false` (`group`).
|
101
99
|
|
102
100
|
### Namespaces
|
103
101
|
|
@@ -119,9 +117,9 @@ You can easily mix methods together and nest namespaces however you want:
|
|
119
117
|
```js
|
120
118
|
logalize.namespace('user login', function () {
|
121
119
|
logalize.info('user login started')
|
122
|
-
logalize.namespace('credentials').log('credentials are
|
120
|
+
logalize.namespace('credentials').log('credentials are {correct}.green')
|
123
121
|
/* code */
|
124
|
-
logalize.info('[success].
|
122
|
+
logalize.info('[success].green')
|
125
123
|
})
|
126
124
|
|
127
125
|
logalize.namespace('namespace 1').log('some more output')
|
@@ -139,8 +137,9 @@ Logalize supports Markdown-like string formatting. Here's the options:
|
|
139
137
|
- `*italic*`
|
140
138
|
- `~strikethrough~`
|
141
139
|
- `_underline_`
|
142
|
-
- `[
|
143
|
-
|
140
|
+
- `[badge text].classOne.classTwo...` (classes are optional)
|
141
|
+
- `{custom text}.classOne.classTwo...` (classes are required). This syntax allows you to apply CSS
|
142
|
+
classes to text in curly braces. Available classes are: `badge`, `bold`, `italic`, `strikethrough`, `underline` and [color classes](#color-classes).
|
144
143
|
|
145
144
|
At the moment, you cannot nest formatting options into each other.
|
146
145
|
Objects and functions are not formattable, but they likely will be in the future.
|
@@ -166,7 +165,7 @@ At the moment, only these attributes are supported: `margin`, `color`, `backgrou
|
|
166
165
|
|
167
166
|
- **There's no way to detect when console output happens**. Development tools are separate from `window` and `document`,
|
168
167
|
and there is no way to know if the output is happening. We can detect things like `console.log`
|
169
|
-
by modifying those functions (hence the `
|
168
|
+
by modifying those functions (hence the `enableConsoleHooks` init parameter), but we cannot know when,
|
170
169
|
say, an error thrown with `throw` is going to appear in console. Groups are implemented in such a way that they don't get closed
|
171
170
|
until it's necessary, so that leads to console output being stuck inside groups it doesn't belong to.
|
172
171
|
Part of the problem is solved by modifying `console`, but another part is not solvable without a browser extension.
|
@@ -191,8 +190,5 @@ The package is available as open source under the terms of the [MIT License](htt
|
|
191
190
|
|
192
191
|
- Support nested formatting
|
193
192
|
- Log history
|
194
|
-
-
|
195
|
-
- Focus mode (see only the logs you need **right now**)
|
196
|
-
- Custom styles in formatting (e.x. `[my text]{color: #434433;}`)
|
197
|
-
- Browser support
|
193
|
+
- Focus mode (see only the logs you need *right now*)
|
198
194
|
- Object and function formatting
|
@@ -1 +1 @@
|
|
1
|
-
!function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=7)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o={log:console.log,debug:console.debug,info:console.info,warn:console.warn,error:console.error,group:console.group,groupCollapsed:console.groupCollapsed,groupEnd:console.groupEnd,assert:console.assert,count:console.count,clear:console.clear,dir:console.dir,dirxml:console.dirxml,profile:console.profile,profileEnd:console.profileEnd,time:console.time,timeEnd:console.timeEnd,timeStamp:console.timeStamp,trace:console.trace};t.default=o},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];a.print.apply(a,["log"].concat(t))}Object.defineProperty(t,"__esModule",{value:!0});var l=r(0),i=o(l),u=r(3),c=o(u),s=r(4),f=o(s);Object.assign(a,{init:function(){this.configure()},configure:function(){function e(e,t){return f.default.clear(),i.default[e].apply(i.default,n(t))}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.enabled,o=void 0===r||r,a=t.enableFormatting,l=void 0===a||a,u=t.setupConsoleHooks,c=void 0===u||u;return Object.assign(this,{enabled:o,enableFormatting:l,setupConsoleHooks:c,formattableMethods:["log","info","debug","warn","error","focus"]}),this.setupConsoleHooks?(console.log=function(){e("log",arguments)},console.debug=function(){e("debug",arguments)},console.info=function(){e("info",arguments)},console.warn=function(){e("warn",arguments)},console.error=function(){e("error",arguments)},console.assert=function(){e("assert",arguments)},console.count=function(){e("count",arguments)},console.dir=function(){e("dir",arguments)},console.dirxml=function(){e("dirxml",arguments)},console.group=function(){e("group",arguments)},console.groupCollapsed=function(){e("groupCollapsed",arguments)},console.groupEnd=function(){e("groupEnd",arguments)},console.profile=function(){e("profile",arguments)},console.profileEnd=function(){e("profileEnd",arguments)},console.time=function(){e("time",arguments)},console.timeEnd=function(){e("timeEnd",arguments)},console.timeStamp=function(){e("timeStamp",arguments)},console.trace=function(){e("trace",arguments)},console.clear=function(){e("clear",arguments)}):(console.log=i.default.log,console.debug=i.default.debug,console.info=i.default.info,console.warn=i.default.warn,console.error=i.default.error,console.assert=i.default.assert,console.count=i.default.count,console.dir=i.default.dir,console.dirxml=i.default.dirxml,console.group=i.default.group,console.groupCollapsed=i.default.groupCollapsed,console.groupEnd=i.default.groupEnd,console.profile=i.default.profile,console.profileEnd=i.default.profileEnd,console.time=i.default.time,console.timeEnd=i.default.timeEnd,console.timeStamp=i.default.timeStamp,console.trace=i.default.trace,console.clear=i.default.clear),f.default.configure({loggingEnabled:this._isEnabled(),collapsed:this.collapseNamespaces}),this},namespace:function(){var e,t=f.default.setNamespace.apply(f.default,arguments);return"function"==(e=arguments.length-1,typeof(arguments.length<=e?void 0:arguments[e]))?t:this},log:function(){this.print.apply(this,["log"].concat(Array.prototype.slice.call(arguments)))},debug:function(){this.print.apply(this,["debug"].concat(Array.prototype.slice.call(arguments)))},info:function(){this.print.apply(this,["info"].concat(Array.prototype.slice.call(arguments)))},warn:function(){this.print.apply(this,["warn"].concat(Array.prototype.slice.call(arguments)))},error:function(){this.print.apply(this,["error"].concat(Array.prototype.slice.call(arguments)))},assert:function(){this.print.apply(this,["assert"].concat(Array.prototype.slice.call(arguments)))},count:function(e){this.print("count",e)},dir:function(e){this.print("dir",e)},dirxml:function(e){this.print("dirxml",e)},profile:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var o=t.pop();if("function"==typeof o){this._isEnabled()&&i.default.profile(t[0]);var n=o();return this._isEnabled()&&this.profileEnd(),n}this._isEnabled()&&i.default.profile(t[0])},profileEnd:function(){this._isEnabled()&&i.default.profileEnd()},time:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var o=t.pop();if("function"==typeof o){this._isEnabled()&&i.default.time(t[0]);var n=o();return this._isEnabled()&&this.timeEnd(t[0]),n}this._isEnabled()&&i.default.time(t[0])},timeEnd:function(e){this._isEnabled()&&i.default.timeEnd(e)},timeStamp:function(e){this._isEnabled()&&i.default.timeStamp(e)},trace:function(e){this.print("trace",e)},group:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var o=t.pop();if("function"==typeof o){this._isEnabled()&&i.default.group.apply(i.default,n(t));var a=o();return this._isEnabled()&&this.groupEnd(),a}this._isEnabled()&&i.default.group.apply(i.default,n(t).concat([o]))},groupCollapsed:function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];var o=t.pop();if("function"==typeof o){this._isEnabled()&&i.default.groupCollapsed.apply(i.default,n(t));var a=o();return this._isEnabled()&&this.groupEnd(),a}this._isEnabled()&&i.default.groupCollapsed.apply(i.default,n(t).concat([o]))},groupEnd:function(){this._isEnabled()&&i.default.groupEnd()},print:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];this._isEnabled()&&(this.formattableMethods.indexOf(e)>-1&&this.enableFormatting&&(r=c.default.format(r)),f.default.group(),i.default[e].apply(i.default,n(r)))},enable:function(){localStorage&&localStorage.setItem("logalizeEnabled","true"),f.default.configure({loggingEnabled:this._isEnabled()})},disable:function(){localStorage&&localStorage.setItem("logalizeEnabled","false"),f.default.configure({loggingEnabled:this._isEnabled()})},_isEnabled:function(){return localStorage&&localStorage.logalizeEnabled?"false"!==localStorage.logalizeEnabled:this.enabled}}),t.default=a},function(e,t,r){t=e.exports=r(6)(),t.push([e.i,"#logalize{color:#000;background-color:transparent;border-radius:0;padding:0;margin:0;font-weight:400;font-style:normal;display:none}#logalize.badge{color:#fff;background-color:#000;border-radius:3px;padding:2px;margin:0 2px}#logalize.badge.blue{color:#fff;background-color:#61afef}#logalize.badge.orange{color:#fff;background-color:#d19a66}#logalize.badge.red{color:#fff;background-color:#e06c75}#logalize.badge.green{color:#fff;background-color:#98c379}#logalize.badge.cyan{color:#fff;background-color:#56b6c2}#logalize.badge.purple{color:#fff;background-color:#c678dd}#logalize.badge.focus{color:#bada55;background:#444}#logalize.blue{color:#4078f2}#logalize.orange{color:#986801}#logalize.red{color:#e45649}#logalize.green{color:#50a14f}#logalize.cyan{color:#0184bc}#logalize.purple{color:#a626a4}#logalize.bold{font-weight:700}#logalize.italic{font-style:italic}#logalize.strikethrough{text-decoration:line-through}#logalize.underline{text-decoration:underline}",""])},function(e,t,r){"use strict";function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var n={format:function(e){var t,r,n=[],a=[],l=0,i=!0,u=!1,c=void 0;try{for(var s,f=e[Symbol.iterator]();!(i=(s=f.next()).done);i=!0){var d=s.value;if(d=this.formatObject(d),"undefined"==typeof d||!d[1].length)break;n.push(d[0]),a.push.apply(a,o(d[1])),l+=1}}catch(e){u=!0,c=e}finally{try{!i&&f.return&&f.return()}finally{if(u)throw c}}if(e.splice(0,l),r=[],n.length){var p;r.push(n.join(" ")),(p=r).push.apply(p,a)}return(t=r).push.apply(t,o(e)),r},formatObject:function(e){if("string"==typeof e)return this.formatString(e)},formatString:function(e){for(var t,r=[];this.canFormat(e);){var o=this.getRelevantMatch(e);t="string"==typeof o.format.classes?o.format.classes:o.format.classes(o.match),e=e.replace(o.format.regex,function(e,t){return"%c"+t+"%c"}),r.push(this.computeStyle(t)),r.push(this.computeStyle("default"))}return[e,r]},canFormat:function(e){var t=!0,r=!1,o=void 0;try{for(var n,a=this.formats[Symbol.iterator]();!(t=(n=a.next()).done);t=!0){var l=n.value;if(l.regex.test(e))return!0}}catch(e){r=!0,o=e}finally{try{!t&&a.return&&a.return()}finally{if(r)throw o}}return!1},getRelevantMatch:function(e){var t=[],r=!0,o=!1,n=void 0;try{for(var a,l=this.formats[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var i=a.value;i.regex.test(e)&&t.push({match:e.match(i.regex),format:i})}}catch(e){o=!0,n=e}finally{try{!r&&l.return&&l.return()}finally{if(o)throw n}}return t.sort(function(e,t){return e.match.index-t.match.index})[0]},computeStyle:function(e){var t=document.createElement("div");t.id="logalize",t.className=e,document.getElementsByTagName("body")[0].appendChild(t);var r=getComputedStyle(t),o=[],n=!0,a=!1,l=void 0;try{for(var i,u=this.supportedStyles[Symbol.iterator]();!(n=(i=u.next()).done);n=!0){var c=i.value;o.push(c+":"+r.getPropertyValue(c))}}catch(e){a=!0,l=e}finally{try{!n&&u.return&&u.return()}finally{if(a)throw l}}return o.join(";")},supportedStyles:["margin","color","background-color","border-radius","padding","font-weight","font-style","text-decoration"],formats:[{regex:/\*\*([^\*]+)\*\*/,classes:"bold"},{regex:/\*([^\*]+)\*/,classes:"italic"},{regex:/~([^~]+)~/,classes:"strikethrough"},{regex:/_([^_]+)_/,classes:"underline"},{regex:/\[([^\[\]]+)\](\.[\.\w]+)/,classes:function(e){return e[2].split(".").join(" ")}}]};t.default=n},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){var r=[],o=!0,n=!1,a=void 0;try{for(var l,i=e[Symbol.iterator]();!(o=(l=i.next()).done)&&(r.push(l.value),!t||r.length!==t);o=!0);}catch(e){n=!0,a=e}finally{try{!o&&i.return&&i.return()}finally{if(n)throw a}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=r(0),i=o(l),u=r(5),c={clojureStack:[],currentStack:[],previousStack:[],configure:function(e){Object.assign(this,e)},setNamespace:function(){for(var e=this,t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=arguments[o];if("function"==typeof r[r.length-1]){var n=r.pop();this.loggingEnabled&&this.clojureStack.push(r);var a=n();if(this.loggingEnabled){var l=this.clojureStack.pop();l.forEach(function(){e.previousStack.pop(),i.default.groupEnd()})}return a}this.loggingEnabled&&this.currentStack.push(r)},group:function(){for(var e=[],t=[].concat(n(this.clojureStack),n(this.currentStack)),r=0;r<t.length;r++){var o=t[r];e.push.apply(e,n(o))}if(!(0,u.compareArrays)(this.previousStack,e)){var l=0,c=!0,s=!1,f=void 0;try{for(var d,p=this.previousStack.entries()[Symbol.iterator]();!(c=(d=p.next()).done);c=!0){var g=d.value,h=a(g,2),y=h[0],m=h[1];if(m!==e[y])break;l+=1}}catch(e){s=!0,f=e}finally{try{!c&&p.return&&p.return()}finally{if(s)throw f}}for(var b=this.previousStack.length-l,v=0;v<b;v++)i.default.groupEnd();var E=e.slice(l),S=!0,_=!1,x=void 0;try{for(var k,A=E[Symbol.iterator]();!(S=(k=A.next()).done);S=!0){var w=k.value;i.default[this._groupingMethod()](w)}}catch(e){_=!0,x=e}finally{try{!S&&A.return&&A.return()}finally{if(_)throw x}}}this.previousStack=e,this.currentStack=[]},clear:function(){[].concat(n(this.clojureStack),n(this.currentStack)).forEach(function(){return i.default.groupEnd()}),this.previousStack=[]},_groupingMethod:function(){return this.collapsed?"groupCollapsed":"group"}};t.default=c},function(e,t,r){"use strict";function o(e,t){if(e.length!==t.length)return!1;var r=!0,a=!1,l=void 0;try{for(var i,u=e.entries()[Symbol.iterator]();!(r=(i=u.next()).done);r=!0){var c=i.value,s=n(c,2),f=s[0],d=s[1];if(d instanceof Array&&t[f]instanceof Array){if(!o(d,t[f]))return!1}else if(d!==t[f])return!1}}catch(e){a=!0,l=e}finally{try{!r&&u.return&&u.return()}finally{if(a)throw l}}return!0}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){var r=[],o=!0,n=!1,a=void 0;try{for(var l,i=e[Symbol.iterator]();!(o=(l=i.next()).done)&&(r.push(l.value),!t||r.length!==t);o=!0);}catch(e){n=!0,a=e}finally{try{!o&&i.return&&i.return()}finally{if(n)throw a}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.compareArrays=o},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var r=this[t];r[2]?e.push("@media "+r[2]+"{"+r[1]+"}"):e.push(r[1])}return e.join("")},e.i=function(t,r){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},n=0;n<this.length;n++){var a=this[n][0];"number"==typeof a&&(o[a]=!0)}for(n=0;n<t.length;n++){var l=t[n];"number"==typeof l[0]&&o[l[0]]||(r&&!l[2]?l[2]=r:r&&(l[2]="("+l[2]+") and ("+r+")"),e.push(l))}},e}},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}var n=r(1),a=o(n),l=r(2),i=o(l),u=document.createElement("style");u.innerHTML=i.default.toString(),document.head.appendChild(u),window.logalize=a.default,window.logalize.init()}]);
|
1
|
+
!function(e){function o(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}var t={};o.m=e,o.c=t,o.i=function(e){return e},o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,o){return Object.prototype.hasOwnProperty.call(e,o)},o.p="",o(o.s=7)}([function(e,o,t){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var r={log:console.log,debug:console.debug,info:console.info,warn:console.warn,error:console.error,group:console.group,groupCollapsed:console.groupCollapsed,groupEnd:console.groupEnd,assert:console.assert,count:console.count,clear:console.clear,dir:console.dir,dirxml:console.dirxml,profile:console.profile,profileEnd:console.profileEnd,time:console.time,timeEnd:console.timeEnd,timeStamp:console.timeStamp,trace:console.trace};o.default=r},function(e,o,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e){if(Array.isArray(e)){for(var o=0,t=Array(e.length);o<e.length;o++)t[o]=e[o];return t}return Array.from(e)}function l(){for(var e=arguments.length,o=Array(e),t=0;t<e;t++)o[t]=arguments[t];l.print.apply(l,["log"].concat(o))}Object.defineProperty(o,"__esModule",{value:!0});var a=t(0),i=r(a),c=t(2),u=r(c),s=t(3),f=r(s),d=t(5),p=r(d);Object.assign(l,{init:function(){this.configure()},configure:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=e.enabled,t=void 0===o||o,r=e.enableFormatting,n=void 0===r||r,l=e.enableConsoleHooks,a=void 0===l||l,i=e.collapseNamespaces,c=void 0!==i&&i;Object.assign(this,{enabled:t,enableFormatting:n,enableConsoleHooks:a,collapseNamespaces:c,formattableMethods:["log","info","debug","warn","error","focus"]}),this.enableFormatting?this.appendStylesToDOM():this.removeStylesFromDOM(),this.enableConsoleHooks?this.setupConsoleHooks():this.removeConsoleHooks(),f.default.configure({loggingEnabled:this.isEnabled(),collapsed:this.collapseNamespaces})},namespace:function(){var e,o=f.default.setNamespace.apply(f.default,arguments);return"function"==(e=arguments.length-1,typeof(arguments.length<=e?void 0:arguments[e]))?o:this},log:function(){this.print.apply(this,["log"].concat(Array.prototype.slice.call(arguments)))},debug:function(){this.print.apply(this,["debug"].concat(Array.prototype.slice.call(arguments)))},info:function(){this.print.apply(this,["info"].concat(Array.prototype.slice.call(arguments)))},warn:function(){this.print.apply(this,["warn"].concat(Array.prototype.slice.call(arguments)))},error:function(){this.print.apply(this,["error"].concat(Array.prototype.slice.call(arguments)))},assert:function(){this.print.apply(this,["assert"].concat(Array.prototype.slice.call(arguments)))},count:function(e){this.print("count",e)},dir:function(e){this.print("dir",e)},dirxml:function(e){this.print("dirxml",e)},profile:function(){for(var e=arguments.length,o=Array(e),t=0;t<e;t++)o[t]=arguments[t];var r=o.pop();if("function"==typeof r){this.isEnabled()&&i.default.profile(o[0]);var n=r();return this.isEnabled()&&this.profileEnd(),n}this.isEnabled()&&i.default.profile(o[0])},profileEnd:function(){this.isEnabled()&&i.default.profileEnd()},time:function(){for(var e=arguments.length,o=Array(e),t=0;t<e;t++)o[t]=arguments[t];var r=o.pop();if("function"==typeof r){this.isEnabled()&&i.default.time(o[0]);var n=r();return this.isEnabled()&&this.timeEnd(o[0]),n}this.isEnabled()&&i.default.time(o[0])},timeEnd:function(e){this.isEnabled()&&i.default.timeEnd(e)},timeStamp:function(e){this.isEnabled()&&i.default.timeStamp(e)},trace:function(e){this.print("trace",e)},group:function(){for(var e=arguments.length,o=Array(e),t=0;t<e;t++)o[t]=arguments[t];var r=o.pop();if("function"==typeof r){this.isEnabled()&&i.default.group.apply(i.default,n(o));var l=r();return this.isEnabled()&&this.groupEnd(),l}this.isEnabled()&&i.default.group.apply(i.default,n(o).concat([r]))},groupCollapsed:function(){for(var e=arguments.length,o=Array(e),t=0;t<e;t++)o[t]=arguments[t];var r=o.pop();if("function"==typeof r){this.isEnabled()&&i.default.groupCollapsed.apply(i.default,n(o));var l=r();return this.isEnabled()&&this.groupEnd(),l}this.isEnabled()&&i.default.groupCollapsed.apply(i.default,n(o).concat([r]))},groupEnd:function(){this.isEnabled()&&i.default.groupEnd()},print:function(e){for(var o=arguments.length,t=Array(o>1?o-1:0),r=1;r<o;r++)t[r-1]=arguments[r];this.isEnabled()&&(this.formattableMethods.indexOf(e)>-1&&this.enableFormatting&&(t=u.default.format(t)),f.default.group(),i.default[e].apply(i.default,n(t)))},enable:function(){localStorage&&localStorage.setItem("logalizeEnabled","true"),f.default.configure({loggingEnabled:this.isEnabled()})},disable:function(){localStorage&&localStorage.setItem("logalizeEnabled","false"),f.default.configure({loggingEnabled:this.isEnabled()})},isEnabled:function(){return localStorage&&localStorage.logalizeEnabled?"false"!==localStorage.logalizeEnabled:this.enabled},setupConsoleHooks:function(){var e=this;console.log=function(){e.performConsoleAction("log",arguments)},console.debug=function(){e.performConsoleAction("debug",arguments)},console.info=function(){e.performConsoleAction("info",arguments)},console.warn=function(){e.performConsoleAction("warn",arguments)},console.error=function(){e.performConsoleAction("error",arguments)},console.assert=function(){e.performConsoleAction("assert",arguments)},console.count=function(){e.performConsoleAction("count",arguments)},console.dir=function(){e.performConsoleAction("dir",arguments)},console.dirxml=function(){e.performConsoleAction("dirxml",arguments)},console.group=function(){e.performConsoleAction("group",arguments)},console.groupCollapsed=function(){e.performConsoleAction("groupCollapsed",arguments)},console.groupEnd=function(){e.performConsoleAction("groupEnd",arguments)},console.profile=function(){e.performConsoleAction("profile",arguments)},console.profileEnd=function(){e.performConsoleAction("profileEnd",arguments)},console.time=function(){e.performConsoleAction("time",arguments)},console.timeEnd=function(){e.performConsoleAction("timeEnd",arguments)},console.timeStamp=function(){e.performConsoleAction("timeStamp",arguments)},console.trace=function(){e.performConsoleAction("trace",arguments)},console.clear=function(){e.performConsoleAction("clear",arguments)}},removeConsoleHooks:function(){console.log=i.default.log,console.debug=i.default.debug,console.info=i.default.info,console.warn=i.default.warn,console.error=i.default.error,console.assert=i.default.assert,console.count=i.default.count,console.dir=i.default.dir,console.dirxml=i.default.dirxml,console.group=i.default.group,console.groupCollapsed=i.default.groupCollapsed,console.groupEnd=i.default.groupEnd,console.profile=i.default.profile,console.profileEnd=i.default.profileEnd,console.time=i.default.time,console.timeEnd=i.default.timeEnd,console.timeStamp=i.default.timeStamp,console.trace=i.default.trace,console.clear=i.default.clear},performConsoleAction:function(e,o){return f.default.clear(),i.default[e].apply(i.default,n(o))},appendStylesToDOM:function(){if(!document.getElementById("logalize-stylesheet")){var e=document.createElement("style");e.id="logalize-stylesheet",e.innerHTML=p.default.toString(),document.head.insertBefore(e,document.head.firstChild)}},removeStylesFromDOM:function(){var e=document.getElementById("logalize-stylesheet");e&&e.remove()}}),o.default=l},function(e,o,t){"use strict";function r(e){if(Array.isArray(e)){for(var o=0,t=Array(e.length);o<e.length;o++)t[o]=e[o];return t}return Array.from(e)}Object.defineProperty(o,"__esModule",{value:!0});var n={format:function(e){var o,t,n=[],l=[],a=0,i=!0,c=!1,u=void 0;try{for(var s,f=e[Symbol.iterator]();!(i=(s=f.next()).done);i=!0){var d=s.value;if(void 0===(d=this.formatObject(d))||!d[1].length)break;n.push(d[0]),l.push.apply(l,r(d[1])),a+=1}}catch(e){c=!0,u=e}finally{try{!i&&f.return&&f.return()}finally{if(c)throw u}}if(e.splice(0,a),t=[],n.length){var p;t.push(n.join(" ")),(p=t).push.apply(p,l)}return(o=t).push.apply(o,r(e)),t},formatObject:function(e){if("string"==typeof e)return this.formatString(e)},formatString:function(e){for(var o,t=[];this.canFormat(e);){var r=this.getRelevantMatch(e);o="string"==typeof r.format.classes?r.format.classes:r.format.classes(r.match),e=e.replace(r.format.regex,function(e,o){return"%c"+o+"%c"}),t.push(this.computeStyle(o)),t.push(this.computeStyle("default"))}return[e,t]},canFormat:function(e){var o=!0,t=!1,r=void 0;try{for(var n,l=this.formats[Symbol.iterator]();!(o=(n=l.next()).done);o=!0){if(n.value.regex.test(e))return!0}}catch(e){t=!0,r=e}finally{try{!o&&l.return&&l.return()}finally{if(t)throw r}}return!1},getRelevantMatch:function(e){var o=[],t=!0,r=!1,n=void 0;try{for(var l,a=this.formats[Symbol.iterator]();!(t=(l=a.next()).done);t=!0){var i=l.value;i.regex.test(e)&&o.push({match:e.match(i.regex),format:i})}}catch(e){r=!0,n=e}finally{try{!t&&a.return&&a.return()}finally{if(r)throw n}}return o.sort(function(e,o){return e.match.index-o.match.index})[0]},computeStyle:function(e){var o=document.createElement("div");o.id="logalize",o.className=e,document.getElementsByTagName("body")[0].appendChild(o);var t=getComputedStyle(o),r=[],n=!0,l=!1,a=void 0;try{for(var i,c=this.supportedStyles[Symbol.iterator]();!(n=(i=c.next()).done);n=!0){var u=i.value;r.push(u+":"+t.getPropertyValue(u))}}catch(e){l=!0,a=e}finally{try{!n&&c.return&&c.return()}finally{if(l)throw a}}return o.remove(),r.join(";")},supportedStyles:["margin","color","background-color","border-radius","padding","font-weight","font-style","text-decoration"],formats:[{regex:/\*\*([^\*]+)\*\*/,classes:"bold"},{regex:/\*([^\*]+)\*/,classes:"italic"},{regex:/~([^~]+)~/,classes:"strikethrough"},{regex:/_([^_]+)_/,classes:"underline"},{regex:/\[([^\[\]]+)\](\.[\.\w]+)?/,classes:function(e){var o="badge";return e[2]&&(o+=e[2]&&e[2].split(".").join(" ")),o}},{regex:/\{([^\{\}]+)\}(\.[\.\w]+)/,classes:function(e){return e[2].split(".").join(" ")}}]};o.default=n},function(e,o,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function n(e){if(Array.isArray(e)){for(var o=0,t=Array(e.length);o<e.length;o++)t[o]=e[o];return t}return Array.from(e)}Object.defineProperty(o,"__esModule",{value:!0});var l=function(){function e(e,o){var t=[],r=!0,n=!1,l=void 0;try{for(var a,i=e[Symbol.iterator]();!(r=(a=i.next()).done)&&(t.push(a.value),!o||t.length!==o);r=!0);}catch(e){n=!0,l=e}finally{try{!r&&i.return&&i.return()}finally{if(n)throw l}}return t}return function(o,t){if(Array.isArray(o))return o;if(Symbol.iterator in Object(o))return e(o,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=t(0),i=r(a),c=t(4),u={clojureStack:[],currentStack:[],previousStack:[],configure:function(e){Object.assign(this,e),this.clear(),this.currentStack=[]},setNamespace:function(){for(var e=this,o=arguments.length,t=Array(o),r=0;r<o;r++)t[r]=arguments[r];if("function"==typeof t[t.length-1]){var n=t.pop();this.loggingEnabled&&this.clojureStack.push(t);var l=n();if(this.loggingEnabled){this.clojureStack.pop().forEach(function(){e.previousStack.pop(),i.default.groupEnd()})}return l}this.loggingEnabled&&this.currentStack.push(t)},group:function(){for(var e=[],o=[].concat(n(this.clojureStack),n(this.currentStack)),t=0;t<o.length;t++){var r=o[t];e.push.apply(e,n(r))}if(!(0,c.compareArrays)(this.previousStack,e)){var a=0,u=!0,s=!1,f=void 0;try{for(var d,p=this.previousStack.entries()[Symbol.iterator]();!(u=(d=p.next()).done);u=!0){var g=d.value,h=l(g,2),m=h[0];if(h[1]!==e[m])break;a+=1}}catch(e){s=!0,f=e}finally{try{!u&&p.return&&p.return()}finally{if(s)throw f}}for(var y=this.previousStack.length-a,v=0;v<y;v++)i.default.groupEnd();var b=e.slice(a),E=!0,S=!1,A=void 0;try{for(var x,k=b[Symbol.iterator]();!(E=(x=k.next()).done);E=!0){var C=x.value;i.default[this._groupingMethod()](C)}}catch(e){S=!0,A=e}finally{try{!E&&k.return&&k.return()}finally{if(S)throw A}}}this.previousStack=e,this.currentStack=[]},clear:function(){[].concat(n(this.clojureStack),n(this.currentStack),n(this.previousStack)).forEach(function(){return i.default.groupEnd()}),this.previousStack=[]},_groupingMethod:function(){return this.collapsed?"groupCollapsed":"group"}};o.default=u},function(e,o,t){"use strict";function r(e,o){if(e.length!==o.length)return!1;var t=!0,l=!1,a=void 0;try{for(var i,c=e.entries()[Symbol.iterator]();!(t=(i=c.next()).done);t=!0){var u=i.value,s=n(u,2),f=s[0],d=s[1];if(d instanceof Array&&o[f]instanceof Array){if(!r(d,o[f]))return!1}else if(d!==o[f])return!1}}catch(e){l=!0,a=e}finally{try{!t&&c.return&&c.return()}finally{if(l)throw a}}return!0}Object.defineProperty(o,"__esModule",{value:!0});var n=function(){function e(e,o){var t=[],r=!0,n=!1,l=void 0;try{for(var a,i=e[Symbol.iterator]();!(r=(a=i.next()).done)&&(t.push(a.value),!o||t.length!==o);r=!0);}catch(e){n=!0,l=e}finally{try{!r&&i.return&&i.return()}finally{if(n)throw l}}return t}return function(o,t){if(Array.isArray(o))return o;if(Symbol.iterator in Object(o))return e(o,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();o.compareArrays=r},function(e,o,t){o=e.exports=t(6)(),o.push([e.i,"#logalize{color:#000;background-color:transparent;border-radius:0;padding:0;margin:0;font-weight:400;font-style:normal;display:none}#logalize.badge{color:#fff;background-color:#000;border-radius:3px;padding:2px;margin:0 2px}#logalize.badge.blue{color:#fff;background-color:#61afef}#logalize.badge.orange{color:#fff;background-color:#d19a66}#logalize.badge.red{color:#fff;background-color:#e06c75}#logalize.badge.green{color:#fff;background-color:#98c379}#logalize.badge.cyan{color:#fff;background-color:#56b6c2}#logalize.badge.purple{color:#fff;background-color:#c678dd}#logalize.badge.focus{color:#bada55;background:#444}#logalize.blue{color:#4078f2}#logalize.orange{color:#986801}#logalize.red{color:#e45649}#logalize.green{color:#50a14f}#logalize.cyan{color:#0184bc}#logalize.purple{color:#a626a4}#logalize.bold{font-weight:700}#logalize.italic{font-style:italic}#logalize.strikethrough{text-decoration:line-through}#logalize.underline{text-decoration:underline}",""])},function(e,o){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],o=0;o<this.length;o++){var t=this[o];t[2]?e.push("@media "+t[2]+"{"+t[1]+"}"):e.push(t[1])}return e.join("")},e.i=function(o,t){"string"==typeof o&&(o=[[null,o,""]]);for(var r={},n=0;n<this.length;n++){var l=this[n][0];"number"==typeof l&&(r[l]=!0)}for(n=0;n<o.length;n++){var a=o[n];"number"==typeof a[0]&&r[a[0]]||(t&&!a[2]?a[2]=t:t&&(a[2]="("+a[2]+") and ("+t+")"),e.push(a))}},e}},function(e,o,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var n=t(1),l=r(n);window.logalize=l.default,window.logalize.init()}]);
|
metadata
CHANGED
@@ -1,18 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logalize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Komarov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
Logalize is a Javascript wrapper for browser's developer console.
|
15
|
-
Its goal is to make debugging easier.
|
13
|
+
description: Logalize is a Javascript wrapper for browser's developer console.
|
16
14
|
email:
|
17
15
|
- ak@akxcv.com
|
18
16
|
executables: []
|
@@ -48,5 +46,5 @@ rubyforge_project:
|
|
48
46
|
rubygems_version: 2.6.8
|
49
47
|
signing_key:
|
50
48
|
specification_version: 4
|
51
|
-
summary:
|
49
|
+
summary: Logalize your developer console
|
52
50
|
test_files: []
|