logalize 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +47 -130
- data/lib/logalize/rails/version.rb +1 -1
- data/vendor/assets/javascripts/logalize.js +1 -13
- metadata +2 -3
- data/vendor/assets/stylesheets/logalize.css +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b38f160a9c0738d8f95b9b6a96a8c2c71ee49015
|
4
|
+
data.tar.gz: dc3626d4ac9d58a5274a712764faa7dc1289e32b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 908a5825505399554fbeaee922b8735ca4d4f033d55717d0bda4a0605c4fcf981618437d40f7d23931be206058a7507df07dfb770332b4f10f8a6197404dcd17
|
7
|
+
data.tar.gz: 88f102c8b3dd3fbb839e81630b3091dff9c8f1e1c8391fa98e81bd355368882ffb59373b13619171bb9a6d5e9ec0c847e69a9cb073a066935fdd894b5a26be9b
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Logalize
|
2
2
|
|
3
|
-
Logalize is a Javascript wrapper for browser's developer console.
|
4
|
-
easier.
|
3
|
+
Logalize is a Javascript wrapper for browser's developer console.
|
5
4
|
|
6
5
|
This is a Rails gem version of the library. For source files and an npm package, go [here](https://github.com/akxcv/logalize).
|
7
6
|
|
@@ -17,97 +16,11 @@ Add this to your `application.js`:
|
|
17
16
|
//= require logalize
|
18
17
|
```
|
19
18
|
|
20
|
-
|
21
|
-
```
|
22
|
-
*= require logalize
|
23
|
-
```
|
24
|
-
|
25
|
-
## Why?
|
26
|
-
|
27
|
-
The builtin developer console in modern browsers suffers from a number of problems. Here are some
|
28
|
-
of the big ones:
|
29
|
-
|
30
|
-
**There's no good way to turn logging on/off.**
|
31
|
-
|
32
|
-
Most of the time you don't want your clients to
|
33
|
-
see debugging output in their console on your production website. But, `console.log` does not
|
34
|
-
care if it runs in development or production, it's going to log anyway. This leads to developers
|
35
|
-
seldom using the console *or* writing `console.log` over and over again just to erase
|
36
|
-
it afterwards (...just to write it back again afterwards, and so on). Disabling the console
|
37
|
-
is still possible (e.x. `if (!debug) console.log = function () {}`), but it's not a good solution
|
38
|
-
if you use other console methods (which you should!). Also, imagine you want to be able to
|
39
|
-
see debugging output in production while normal website users don't see anything. What do you do?
|
40
|
-
|
41
|
-
Logalize solves this problem by introducing a flexible enable/disable mechanism. First of all, you
|
42
|
-
can enable or disable it during initialization: `logalize = new Logalize({ enabled: debug })`
|
43
|
-
(assuming that `debug` is `true` in development and `false` in production). But also, you can
|
44
|
-
enable or disable Logalize in your browser (`logalize.enable()` or `logalize.disable()`), which will
|
45
|
-
override the global `enabled` option. Thus, you can easily switch Logalize on/off in any environment,
|
46
|
-
and it will only affect *your* console.
|
47
|
-
|
48
|
-
See [initialization options](#initialization-options).
|
49
|
-
|
50
|
-
**`console.group` is a great idea, but it's not implemented well**
|
51
|
-
|
52
|
-
With [`console.group`](https://developers.google.com/web/tools/chrome-devtools/console/console-reference#group) you can split your output in foldable groups, which is a *very* good thing
|
53
|
-
to be able to do. However, a lot of JS these days is *asynchronous*, which is something you have
|
54
|
-
to constantly think about if you want to group your output.
|
19
|
+
## Main features
|
55
20
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
async function f1() {
|
60
|
-
console.group('group 1');
|
61
|
-
console.log('function 1 start');
|
62
|
-
await sleep(1000);
|
63
|
-
console.log('function 1 end');
|
64
|
-
console.groupEnd();
|
65
|
-
}
|
66
|
-
|
67
|
-
async function f2() {
|
68
|
-
console.group('group 2');
|
69
|
-
console.log('function 2 start');
|
70
|
-
await sleep(500);
|
71
|
-
console.log('function 2 end');
|
72
|
-
console.groupEnd();
|
73
|
-
}
|
74
|
-
|
75
|
-
f1(); f2()
|
76
|
-
```
|
77
|
-
|
78
|
-
Result:
|
79
|
-
|
80
|
-
![Async and groups](/images/async_console_groups.png?raw=true)
|
81
|
-
|
82
|
-
Logalize solves this by creating a different implementation of groups. With Logalize, you can use
|
83
|
-
groups like this:
|
84
|
-
|
85
|
-
```js
|
86
|
-
logalize.group('my namespace').log('hello from my namespace')
|
87
|
-
/* or */
|
88
|
-
logalize.group('my namespace', function () {
|
89
|
-
logalize.log('hello from my namespace')
|
90
|
-
/* ... */
|
91
|
-
})
|
92
|
-
```
|
93
|
-
|
94
|
-
See [grouping](#grouping)
|
95
|
-
|
96
|
-
**`console.log` supports formatting with CSS, but it's not convenient**
|
97
|
-
|
98
|
-
`console` supports formatting with CSS rules:
|
99
|
-
|
100
|
-
```js
|
101
|
-
console.log('roses are %cred%c, violets are %cblue', 'color: red;', 'color: black;', 'color: blue;')
|
102
|
-
```
|
103
|
-
|
104
|
-
Result:
|
105
|
-
|
106
|
-
![Console formatting](/images/console_formatting.png?raw=true)
|
107
|
-
|
108
|
-
This is awesome, but really not convenient.
|
109
|
-
|
110
|
-
Logalize makes formatting much easier by introducing a markdown-like syntax. See [formatting](#formatting).
|
21
|
+
- Easily enable/disable logging.
|
22
|
+
- [Namespaces](#namespaces).
|
23
|
+
- [Markdown-like formatting](#formatting).
|
111
24
|
|
112
25
|
## Browser support
|
113
26
|
|
@@ -115,6 +28,14 @@ TBD
|
|
115
28
|
|
116
29
|
## Usage
|
117
30
|
|
31
|
+
Enable or disable logging:
|
32
|
+
```js
|
33
|
+
// Disable logalize
|
34
|
+
logalize.configure({ enabled: false })
|
35
|
+
// Enable logalize only for yourself (writes to localStorage)
|
36
|
+
logalize.enable()
|
37
|
+
```
|
38
|
+
|
118
39
|
Methods that work exactly like their console's counterparts:
|
119
40
|
|
120
41
|
- [`assert`](https://developers.google.com/web/tools/chrome-devtools/console/console-reference#assert)
|
@@ -136,81 +57,80 @@ see [known issues](#known-issues)
|
|
136
57
|
|
137
58
|
Also:
|
138
59
|
|
139
|
-
- [`
|
60
|
+
- [`group`, `groupCollapsed` and `groupEnd`](https://developers.google.com/web/tools/chrome-devtools/console/console-reference#profile),
|
61
|
+
[`profile` and `profileEnd`](https://developers.google.com/web/tools/chrome-devtools/console/console-reference#profile)
|
140
62
|
as well as
|
141
63
|
[`time` and `timeEnd`](https://developers.google.com/web/tools/chrome-devtools/console/console-reference#time)
|
142
64
|
support lambda syntax:
|
143
65
|
|
144
66
|
```js
|
145
|
-
logalize.
|
67
|
+
logalize.group('group1')
|
146
68
|
myVar = myFunction()
|
147
|
-
logalize.
|
69
|
+
logalize.groupEnd()
|
148
70
|
|
149
71
|
/* is the same as */
|
150
72
|
|
151
|
-
myVar = logalize.
|
73
|
+
myVar = logalize.group('group1', myFunction)
|
152
74
|
```
|
153
75
|
|
154
|
-
|
76
|
+
Also:
|
77
|
+
```js
|
78
|
+
logalize('my output')
|
79
|
+
// is the same as:
|
80
|
+
logalize.log('my output')
|
81
|
+
```
|
155
82
|
|
156
|
-
###
|
83
|
+
### Configuration options
|
157
84
|
|
158
85
|
```js
|
159
|
-
logalize
|
86
|
+
logalize.configure({
|
160
87
|
enabled: true,
|
161
88
|
enableFormatting: true,
|
162
|
-
|
163
|
-
modifyConsole: true
|
89
|
+
setupConsoleHooks: true
|
164
90
|
})
|
165
91
|
```
|
166
|
-
- `
|
167
|
-
When Logalize is disabled, it will not produce any output. However, lambda versions of `profile`, `time
|
92
|
+
- `enabled`: Defines whether to enable or disable Logalize.
|
93
|
+
When Logalize is disabled, it will not produce any output. However, lambda versions of `profile`, `time`, `group` and `namespace`
|
94
|
+
will still execute given functions. Default: `true`.
|
168
95
|
- `enableFormatting`: Defines whether [formatting](#formatting) should be enabled. Default: `true`.
|
169
|
-
- `
|
170
|
-
collapsed or not. Default: `false` (expanded).
|
171
|
-
- `modifyConsole`: Defines whether Logalize needs to modify `console` upon initialization.
|
96
|
+
- `setupConsoleHooks`: Defines whether Logalize needs to modify `console`.
|
172
97
|
Generally, modifying global objects is a bad thing to do, but this is required if you want Logalize to
|
173
98
|
handle console output correctly. Logalize is modifying `console` functions *very carefully* (it just
|
174
99
|
needs to hook to those methods). You can safely disable this options, but regular console output
|
175
100
|
will occasionally get stuck inside groups it does not belong to. see [known issues](#known-issues). Default: `true`.
|
176
101
|
|
177
|
-
###
|
102
|
+
### Namespaces
|
178
103
|
|
179
|
-
|
104
|
+
Namespaces are like groups but more convenient:
|
180
105
|
|
181
106
|
```js
|
182
107
|
/* method 1 */
|
183
|
-
logalize.
|
108
|
+
logalize.namespace('namespace one').log('inside namespace 1')
|
184
109
|
|
185
110
|
/* method 2 */
|
186
|
-
logalize.
|
187
|
-
logalize.log('inside
|
111
|
+
val = logalize.namespace('namespace one', function () {
|
112
|
+
logalize.log('inside namespace 1')
|
113
|
+
return 'veryImportantValue'
|
188
114
|
})
|
189
115
|
```
|
190
116
|
|
191
|
-
You can easily mix methods together and nest
|
117
|
+
You can easily mix methods together and nest namespaces however you want:
|
192
118
|
|
193
119
|
```js
|
194
|
-
logalize.
|
120
|
+
logalize.namespace('user login', function () {
|
195
121
|
logalize.info('user login started')
|
196
|
-
logalize.
|
122
|
+
logalize.namespace('credentials').log('credentials are [correct].green')
|
197
123
|
/* code */
|
198
124
|
logalize.info('[success].badge.green')
|
199
125
|
})
|
200
126
|
|
201
|
-
logalize.
|
202
|
-
logalize.
|
127
|
+
logalize.namespace('namespace 1').log('some more output')
|
128
|
+
logalize.namespace('namespace 1', 'another namespace!').log('still nested correctly')
|
203
129
|
```
|
204
130
|
|
205
131
|
Output:
|
206
132
|
|
207
|
-
![
|
208
|
-
|
209
|
-
When `document` is not in focus (e.g. your console is in focus), the output becomes:
|
210
|
-
|
211
|
-
![Inline group output](/images/inline_group_output.png?raw=true)
|
212
|
-
|
213
|
-
This behaviour is explained in [known issues](#known-issues).
|
133
|
+
![Namespace output](/images/namespace_output.png?raw=true)
|
214
134
|
|
215
135
|
### Formatting
|
216
136
|
|
@@ -246,20 +166,17 @@ At the moment, only these attributes are supported: `margin`, `color`, `backgrou
|
|
246
166
|
|
247
167
|
- **There's no way to detect when console output happens**. Development tools are separate from `window` and `document`,
|
248
168
|
and there is no way to know if the output is happening. We can detect things like `console.log`
|
249
|
-
by modifying those functions (hence the `
|
169
|
+
by modifying those functions (hence the `setupConsoleHooks` init parameter), but we cannot know when,
|
250
170
|
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
|
251
171
|
until it's necessary, so that leads to console output being stuck inside groups it doesn't belong to.
|
252
172
|
Part of the problem is solved by modifying `console`, but another part is not solvable without a browser extension.
|
253
|
-
|
254
|
-
This enables us to change how groups work if `document` is not in focus (say, `console` is in focus).
|
255
|
-
However, some things (like `throw` or click on the "clear console" button) are simply not catchable.
|
256
|
-
So, **some output will inevitably get stuck in a group it doesn't belong**. Beware of this, especially when using `collapseGroups = true`.
|
173
|
+
So, **some output will inevitably get stuck in a group it doesn't belong**.
|
257
174
|
|
258
175
|
- **Stack traces from `logalize.error` and `logalize.trace` contain unneeded information**.
|
259
176
|
Since `logalize.error` and `logalize.trace` call some functions under the hood, the stack trace produced
|
260
177
|
by those functions will contain several unneeded calls.
|
261
178
|
|
262
|
-
*All of this is according to the author's research. If you know a solution to
|
179
|
+
*All of this is according to the author's research. If you know a solution to any of these problems, you're
|
263
180
|
highly encouraged to open an issue and/or a pull request at [akxcv/logalize](https://github.com/akxcv/logalize).*
|
264
181
|
|
265
182
|
## Contributing
|
@@ -272,7 +189,7 @@ The package is available as open source under the terms of the [MIT License](htt
|
|
272
189
|
|
273
190
|
## TODO
|
274
191
|
|
275
|
-
- Support nested
|
192
|
+
- Support nested formatting
|
276
193
|
- Log history
|
277
194
|
- Replace stylesheet with in-memory CSS?
|
278
195
|
- Focus mode (see only the logs you need **right now**)
|
@@ -1,13 +1 @@
|
|
1
|
-
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
2
|
-
window.Logalize=require("./index");
|
3
|
-
},{"./index":5}],2:[function(require,module,exports){
|
4
|
-
var BrowserAdapter={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,dir:console.dir,dirxml:console.dirxml,profile:console.profile,profileEnd:console.profileEnd,time:console.time,timeEnd:console.timeEnd,timeStamp:console.timeStamp,trace:console.trace};module.exports=BrowserAdapter;
|
5
|
-
|
6
|
-
},{}],3:[function(require,module,exports){
|
7
|
-
var Formatter={format:function(t){var e,r=[],a=[],s=0;for(var o in t){var n=this.formatObject(t[o]);if("undefined"==typeof n||!n[1].length)break;r.push(n[0]),a.push.apply(a,n[1]),s+=1}return t.splice(0,s),e=[],r.length&&(e.push(r.join(" ")),e.push.apply(e,a)),e.push.apply(e,t),e},formatObject:function(t){if("string"==typeof t)return this.formatString(t)},formatString:function(t){for(var e,r=[];this.canFormat(t);){var a=this.getRelevantMatch(t);e="string"==typeof a.format.classes?a.format.classes:a.format.classes(a.match),t=t.replace(a.format.regex,function(t,e){return"%c"+e+"%c"}),r.push(this.computeStyle(e)),r.push(this.computeStyle("default"))}return[t,r]},canFormat:function(t){for(var e in this.formats)if(this.formats[e].regex.test(t))return!0;return!1},getRelevantMatch:function(t){var e=[];for(var r in this.formats){var a=this.formats[r];a.regex.test(t)&&e.push({match:t.match(a.regex),format:a})}return e.sort(function(t,e){return t.match.index-e.match.index})[0]},computeStyle:function(t){var e=document.createElement("div");e.id="logalize",e.className=t,e.style="display: none;",document.getElementsByTagName("body")[0].appendChild(e);var r=getComputedStyle(e),a=[];for(var s in this.supportedStyles){var o=this.supportedStyles[s];a.push(o+":"+r.getPropertyValue(o))}return a.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(t){return t[2].split(".").join(" ")}}]};module.exports=Formatter;
|
8
|
-
|
9
|
-
},{}],4:[function(require,module,exports){
|
10
|
-
var BrowserAdapter=require("./browserAdapter"),GroupManager={currentStack:[],previousStack:[],globalStack:[],bindEvents:function(){var r=this;window.addEventListener("blur",function(){r.clear()})},group:function(r,t,e){if(e?(this.ungroup(!1),this.globalStack.push(t)):this.currentStack=t,document.hasFocus()){var o;if(e)for(o in t)BrowserAdapter[r](t[o]);else{var a=0;for(o in this.currentStack)this.previousStack[o]===this.currentStack[o]&&(a+=1);var n=this.previousStack.length-a;for(o=0;o<n;o++)BrowserAdapter.groupEnd();var c=this.currentStack.slice(a);for(o in c)BrowserAdapter[r](c[o])}}},ungroup:function(r){if(this.previousStack.length&&!this.currentStack.length&&this.previousStack.forEach(function(){BrowserAdapter.groupEnd()}),r){var t=this.globalStack.pop();t.forEach(function(){BrowserAdapter.groupEnd()})}this.previousStack=this.currentStack,this.currentStack=[]},clear:function(){this.previousStack.forEach(function(){BrowserAdapter.groupEnd()}),this.currentStack.forEach(function(){BrowserAdapter.groupEnd()}),this.previousStack=[]}};module.exports=GroupManager;
|
11
|
-
},{"./browserAdapter":2}],5:[function(require,module,exports){
|
12
|
-
function Logalize(o){var e={enabled:!0,enableFormatting:!0,collapseGroups:!1,modifyConsole:!0};o||(o={});for(var r in e)o.hasOwnProperty(r)||(o[r]=e[r]);if(this.enabled=o.enabled,this.enableFormatting=o.enableFormatting,this.collapseGroups=o.collapseGroups,this.formattableMethods=["log","info","debug","warn","error","focus"],GroupManager.bindEvents(),o.modifyConsole){var n=function(o,e){return GroupManager.clear(),BrowserAdapter[o].apply(BrowserAdapter,e)};console.log=function(){n("log",arguments)},console.debug=function(){n("debug",arguments)},console.info=function(){n("info",arguments)},console.warn=function(){n("warn",arguments)},console.error=function(){n("error",arguments)},console.assert=function(){n("assert",arguments)},console.clear=function(){GroupManager.clear()},console.count=function(){n("count",arguments)},console.dir=function(){n("dir",arguments)},console.dirxml=function(){n("dirxml",arguments)},console.group=function(){n("group",arguments)},console.groupCollapsed=function(){n("groupCollapsed",arguments)},console.groupEnd=function(){n("groupEnd",arguments)},console.profile=function(){n("profile",arguments)},console.profileEnd=function(){n("profileEnd",arguments)},console.time=function(){n("time",arguments)},console.timeEnd=function(){n("timeEnd",arguments)},console.timeStamp=function(){n("timeStamp",arguments)},console.trace=function(){n("trace",arguments)}}}var GroupManager=require("./groupManager"),BrowserAdapter=require("./browserAdapter"),Formatter=require("./formatter");Logalize.prototype={log:function(){this.print("log",[].slice.call(arguments))},debug:function(){this.print("debug",[].slice.call(arguments))},info:function(){this.print("info",[].slice.call(arguments))},warn:function(){this.print("warn",[].slice.call(arguments))},error:function(){this.print("error",[].slice.call(arguments))},assert:function(){this.print("assert",[].slice.call(arguments))},count:function(o){this.print("count",[o])},dir:function(o){this.print("dir",[o])},dirxml:function(o){this.print("dirxml",[o])},profile:function(){var o=[].slice.call(arguments),e=o.pop();if("function"==typeof e){this._isEnabled()&&BrowserAdapter.profile(o[0]);var r=e.call();return this.profileEnd(),r}this._isEnabled()&&BrowserAdapter.profile(o[0])},profileEnd:function(){this._isEnabled()&&BrowserAdapter.profileEnd()},time:function(){var o=[].slice.call(arguments),e=o.pop();if("function"==typeof e){this._isEnabled()&&BrowserAdapter.time(o[0]);var r=e.call();return this.timeEnd(o[0]),r}this._isEnabled()&&BrowserAdapter.time(o[0])},timeEnd:function(o){this._isEnabled()&&BrowserAdapter.timeEnd(o)},timeStamp:function(o){this._isEnabled()&&BrowserAdapter.timeStamp(o)},trace:function(o){this.print("trace",[o])},group:function(){var o=[].slice.call(arguments),e=this.collapseGroups?"groupCollapsed":"group";if("function"==typeof o[o.length-1]){var r=o.pop();this._isEnabled()&&GroupManager.group(e,o,!0);var n=r.call();return this._isEnabled()&&GroupManager.ungroup(!0),n}return this._isEnabled()&&GroupManager.group(e,o),this},print:function(o,e){if(GroupManager.ungroup(),this._isEnabled()){var r=!document.hasFocus()&&GroupManager.previousStack.length+GroupManager.globalStack.length;if(r){var n=[],t=GroupManager.previousStack;t.unshift.apply(t,GroupManager.globalStack.reduce(function(o,e){return o.concat(e)},[])),GroupManager.previousStack=[];for(var i in t)n.push(t[i]);var a=n.join(" -> ")+" :: ";"string"==typeof e[0]?e[0]=a+e[0]:e.unshift(a)}this.formattableMethods.indexOf(o)>-1&&this.enableFormatting&&(e=Formatter.format(e)),r?(BrowserAdapter.groupCollapsed.apply(BrowserAdapter,e),BrowserAdapter.groupEnd()):BrowserAdapter[o].apply(BrowserAdapter,e)}},enable:function(){localStorage&&localStorage.setItem("logalizeEnabled","true")},disable:function(){localStorage&&localStorage.setItem("logalizeEnabled","false")},_isEnabled:function(){return localStorage&&localStorage.logalizeEnabled?"false"!==localStorage.logalizeEnabled:this.enabled}},module.exports=Logalize;
|
13
|
-
},{"./browserAdapter":2,"./formatter":3,"./groupManager":4}]},{},[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()}]);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.3
|
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-02
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Logalize is a Javascript wrapper for browser's developer console.
|
@@ -25,7 +25,6 @@ files:
|
|
25
25
|
- lib/logalize/rails/engine.rb
|
26
26
|
- lib/logalize/rails/version.rb
|
27
27
|
- vendor/assets/javascripts/logalize.js
|
28
|
-
- vendor/assets/stylesheets/logalize.css
|
29
28
|
homepage: https://github.com/akxcv/logalize
|
30
29
|
licenses:
|
31
30
|
- MIT
|
@@ -1,55 +0,0 @@
|
|
1
|
-
#logalize {
|
2
|
-
color: black;
|
3
|
-
background-color: transparent;
|
4
|
-
border-radius: 0;
|
5
|
-
padding: 0;
|
6
|
-
margin: 0;
|
7
|
-
font-weight: normal;
|
8
|
-
font-style: normal; }
|
9
|
-
#logalize.badge {
|
10
|
-
color: white;
|
11
|
-
background-color: black;
|
12
|
-
border-radius: 3px;
|
13
|
-
padding: 2px;
|
14
|
-
margin: 0 2px; }
|
15
|
-
#logalize.badge.blue {
|
16
|
-
color: white;
|
17
|
-
background-color: #61afef; }
|
18
|
-
#logalize.badge.orange {
|
19
|
-
color: white;
|
20
|
-
background-color: #d19a66; }
|
21
|
-
#logalize.badge.red {
|
22
|
-
color: white;
|
23
|
-
background-color: #e06c75; }
|
24
|
-
#logalize.badge.green {
|
25
|
-
color: white;
|
26
|
-
background-color: #98c379; }
|
27
|
-
#logalize.badge.cyan {
|
28
|
-
color: white;
|
29
|
-
background-color: #56b6c2; }
|
30
|
-
#logalize.badge.purple {
|
31
|
-
color: white;
|
32
|
-
background-color: #c678dd; }
|
33
|
-
#logalize.badge.focus {
|
34
|
-
color: #bada55;
|
35
|
-
background: #444; }
|
36
|
-
#logalize.blue {
|
37
|
-
color: #4078f2; }
|
38
|
-
#logalize.orange {
|
39
|
-
color: #986801; }
|
40
|
-
#logalize.red {
|
41
|
-
color: #e45649; }
|
42
|
-
#logalize.green {
|
43
|
-
color: #50a14f; }
|
44
|
-
#logalize.cyan {
|
45
|
-
color: #0184bc; }
|
46
|
-
#logalize.purple {
|
47
|
-
color: #a626a4; }
|
48
|
-
#logalize.bold {
|
49
|
-
font-weight: bold; }
|
50
|
-
#logalize.italic {
|
51
|
-
font-style: italic; }
|
52
|
-
#logalize.strikethrough {
|
53
|
-
text-decoration: line-through; }
|
54
|
-
#logalize.underline {
|
55
|
-
text-decoration: underline; }
|