loglevel 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -3
- data/lib/loglevel/loggable_class.rb +2 -1
- data/lib/loglevel/loggable_class/level.rb +1 -1
- data/lib/loglevel/settings.rb +4 -4
- data/lib/loglevel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13691fc54a23f08687bcde3b89f3023fc2402d9b
|
4
|
+
data.tar.gz: eca0acbd40c05f1d0d4bbc37a69ae11e7a1f1297
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a57ae97f3b9fda400b5e85b8ec21592030dc31d9dd79fc441deb82490e8060106141c46f7c15e213d0605c255213469476af76552d427a29ec4cbd1e27f022e9
|
7
|
+
data.tar.gz: 2a77c5cb2f3a9bad5ad0bf7310c1e6070a3bebb90fbb95d9dc8bb26e57da9ba9c9a2cd6e8907fc3cb56b57042d2924f36d78e8d644a609a977b7f984d6b223f6
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ environment variable. For instance:
|
|
29
29
|
LOGLEVEL=DEBUG,NOAR,NOHTTP rails server
|
30
30
|
```
|
31
31
|
|
32
|
-
would set the Rails logger level to
|
32
|
+
would set the Rails logger level to `DEBUG` but would suppress messages from
|
33
33
|
the ActiveRecord logger and the HttpLogger gem.
|
34
34
|
|
35
35
|
Here are the available settings:
|
@@ -42,6 +42,7 @@ Here are the available settings:
|
|
42
42
|
| INFO | Equivalent to config.log_level = :info |
|
43
43
|
| DEBUG | Equivalent to config.log_level = :debug |
|
44
44
|
| NOAR | Do not show ActiveRecord messages |
|
45
|
+
| HTTP | Show HTTP messages |
|
45
46
|
| NOHTTP | Do not show HTTP messages |
|
46
47
|
| NOHEADERS | Do not include response headers in HTTP log |
|
47
48
|
| NOBODY | Do not include response body in HTTP log |
|
@@ -52,8 +53,25 @@ The examples in this document assume Loglevel is being used in a Rails
|
|
52
53
|
environment but it doesn't depend on Rails and can be used in other contexts.
|
53
54
|
|
54
55
|
There are specific options to handle Railsy logging scenarios: things like
|
55
|
-
controlling ActiveRecord logging.
|
56
|
-
|
56
|
+
controlling ActiveRecord logging.
|
57
|
+
|
58
|
+
### HttpLogger
|
59
|
+
|
60
|
+
The HttpLogger gem works in a slightly different way. When we set the level for HttpLogger we are setting the level *at which* the HTTP messages are logged.
|
61
|
+
|
62
|
+
In the Loglevel environment this will be `:debug`, so you will only see HTTP messages if `LOGLEVEL=DEBUG`. If you want to see HTTP messages at a less verbose level then use the `HTTP` parameter when setting `LOGLEVEL`, like this:
|
63
|
+
|
64
|
+
```sh
|
65
|
+
LOGLEVEL=INFO,HTTP rails server
|
66
|
+
```
|
67
|
+
|
68
|
+
This will show all messages at `INFO` and above and will also show HTTP messages.
|
69
|
+
|
70
|
+
If you want to see `DEBUG` messages but *not* HTTP messages then use the `NOHTTP` parameter:
|
71
|
+
|
72
|
+
```sh
|
73
|
+
LOGLEVEL=DEBUG,NOHTTP rails server
|
74
|
+
```
|
57
75
|
|
58
76
|
### Rails initialization
|
59
77
|
|
@@ -51,7 +51,8 @@ module Loglevel
|
|
51
51
|
# Setup for HttpLogger. Here we are setting the level at which to log HTTP
|
52
52
|
# interactions
|
53
53
|
def http_setup
|
54
|
-
return unless http?
|
54
|
+
return unless http?
|
55
|
+
raise Loglevel::Exception::ClassNotLoggable, class_name unless settings.http?
|
55
56
|
regular_setup
|
56
57
|
additional_http_setup
|
57
58
|
end
|
data/lib/loglevel/settings.rb
CHANGED
@@ -8,19 +8,19 @@ module Loglevel
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def http?
|
11
|
-
!lookup('NOHTTP')
|
11
|
+
@http ||= lookup('HTTP') || (level == 'DEBUG' && !lookup('NOHTTP'))
|
12
12
|
end
|
13
13
|
|
14
14
|
def active_record?
|
15
|
-
!lookup('NOAR')
|
15
|
+
@active_record ||= !lookup('NOAR')
|
16
16
|
end
|
17
17
|
|
18
18
|
def response_body?
|
19
|
-
!lookup('NOBODY')
|
19
|
+
@response_body ||= !lookup('NOBODY')
|
20
20
|
end
|
21
21
|
|
22
22
|
def request_headers?
|
23
|
-
!lookup('NOHEADERS')
|
23
|
+
@request_headers ||= !lookup('NOHEADERS')
|
24
24
|
end
|
25
25
|
|
26
26
|
private
|
data/lib/loglevel/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loglevel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominic Sayers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple gem to control logging at runtime with an environment variable
|
14
14
|
email:
|