delogger 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +21 -0
- data/README.md +61 -0
- data/vendor/assets/javascripts/delogger.js +1 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 672d8606949ceabad14a788b3a3957e7243521cb
|
4
|
+
data.tar.gz: 210e90fa7fdeeecd3b1458e8a1f74e1c153cdad4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 313e5a48a70a090a29eaa7263be63bed5d6565c6b4c92eac5d4d9372f84aabe7b6d0f616cf839752c5109bebf57bd232a1306b502cacf779679602941e239359
|
7
|
+
data.tar.gz: 8f82e962af93dd9435a994fbda0e2f78efae5c6f94f61ca887e8b2f60ce8bdd3d1c58fd66fd7d4b0639dee2a457936726774fc5dc9bad2a6f50d1456d7f8cd95
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Alexander Komarov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Delogger
|
2
|
+
|
3
|
+
This gem is a work in progress.
|
4
|
+
TODO
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'delogger'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install delogger
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
These methods work similarly to `console.log`, but they support [formatting](#formatting):
|
25
|
+
- `DeLogger.debug`
|
26
|
+
- `DeLogger.warn`
|
27
|
+
- `DeLogger.error`
|
28
|
+
|
29
|
+
By default, DeLogger is **disabled**. To enable it, use `DeLogger.enable()`. You can disable it again
|
30
|
+
using `DeLogger.disable()`.
|
31
|
+
|
32
|
+
## Logging levels
|
33
|
+
|
34
|
+
DeLogger has three logging levels: `debug`, `warn` and `error`. Level can be set using `DeLogger.level`
|
35
|
+
(default is `debug`). (TODO)
|
36
|
+
|
37
|
+
## Formatting
|
38
|
+
|
39
|
+
DeLogger supports string formatting. Syntax: `"(my text).class1.class2"`. Classes are specific for
|
40
|
+
the logger and are not being fetched from stylesheets.
|
41
|
+
Supported classes: `badge`, `debug`, `warn`, `error`, `bold`, `italic`.
|
42
|
+
Example:
|
43
|
+
```js
|
44
|
+
DeLogger.log("(MyClass#myMethod).badge", "(@akxcv).badge.warn", "(bold).bold", { foo: 'bar' })
|
45
|
+
```
|
46
|
+
![Example output](/images/example.png?raw=true)
|
47
|
+
|
48
|
+
TODO
|
49
|
+
|
50
|
+
## Development
|
51
|
+
|
52
|
+
TODO
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/delogger.
|
57
|
+
|
58
|
+
|
59
|
+
## License
|
60
|
+
|
61
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -0,0 +1 @@
|
|
1
|
+
(function(){var r=[].slice;this.DeLogger=function(){function e(){}var n,l,a,t,o,c;return e.debug=function(){var e;return e=1<=arguments.length?r.call(arguments,0):[],o.apply(null,["debug",a("badge","debug")].concat(r.call(e)))},e.warn=function(){var e;return e=1<=arguments.length?r.call(arguments,0):[],o.apply(null,["warn",a("badge","warn")].concat(r.call(e)))},e.error=function(){var e;return e=1<=arguments.length?r.call(arguments,0):[],o.apply(null,["error",a("badge","error")].concat(r.call(e)))},e.enable=function(){return localStorage.setItem("deloggerEnabled",!0)},e.disable=function(){return localStorage.removeItem("deloggerEnabled")},e.setLevel=function(r){return localStorage.setItem("deloggerLevel",r)},o=function(){var e,n,a,o,c,u,g,i,d,f,b,p;if(g=arguments[0],c=arguments[1],n=3<=arguments.length?r.call(arguments,2):[],l(g)){for(p="%c"+g,b=[c],a=0,o=0,u=n.length;o<u&&(e=n[o],"string"==typeof e);o++)i=t(e),d=i[0],f=i[1],p+=d,b.push(f),a+=1;return n.splice(0,a),console.log.apply(console,[p].concat(r.call(b),r.call(n)))}},l=function(r){return null!=localStorage.deloggerEnabled&&n().indexOf(r)!==-1},n=function(){switch(localStorage.deloggerLevel){case"debug":return["debug","warn","error"];case"warn":return["warn","error"];case"error":return["error"];default:return["debug","warn","error"]}},t=function(e){var n,l,t;return(t=e.match(/^\((.+)\)(\..+)$/))?(n=t[2].split("."),l=a.apply(null,r.call(n).concat(["after"])),["%c"+t[1],l]):["%c"+e,a("default","after")]},a=function(){var e,n,l,a,t,o,u;for(e=1<=arguments.length?r.call(arguments,0):[],o="",n=0,t=e.length;n<t;n++)a=e[n],o+=function(){var r,e;r=c()[a],e=[];for(l in r)u=r[l],e.push(l+":"+u+";");return e}().join("");return o},c=function(){return{"default":{},badge:{color:"white",background:"black","border-radius":"9px",padding:"1px 5px"},debug:{background:"blue"},warn:{background:"orange"},error:{background:"red"},bold:{"font-weight":"bold"},italic:{"font-style":"italic"},after:{"margin-left":"3px"}}},e}()}).call(this);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Komarov
|
@@ -72,7 +72,10 @@ email:
|
|
72
72
|
executables: []
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
|
-
files:
|
75
|
+
files:
|
76
|
+
- LICENSE.txt
|
77
|
+
- README.md
|
78
|
+
- vendor/assets/javascripts/delogger.js
|
76
79
|
homepage: https://github.com/akxcv/delogger
|
77
80
|
licenses:
|
78
81
|
- MIT
|