minimal_logging 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -3
- data/lib/minimal_logging/rails_extensions/logger_extension.rb +20 -1
- data/lib/minimal_logging/version.rb +1 -1
- data/lib/minimal_logging.rb +10 -0
- 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: a0a1f4aa43339b09936779f475d6f20f6bf04a43
|
4
|
+
data.tar.gz: d433a85e1ae4343e043de53eb796bb33831864c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c31693023128a6e6ab5fe1eeedc0bd14c0b5bd99a41a61b702d4551ae689394a867aecb1b1a97158dae4d33bd089963db00bdab04adab205ca9028076566405f
|
7
|
+
data.tar.gz: b7b745c41551aac23bbe12989ed352e46960c13455ecb2fb1e32bdd7770c13d625bb4d29734c9c9012188ca35a11d89117b2a9dd6afa308cb1fd4be6fc046ca1
|
data/README.md
CHANGED
@@ -27,14 +27,19 @@ Or install it yourself:
|
|
27
27
|
|
28
28
|
## Usage
|
29
29
|
|
30
|
-
|
30
|
+
You can set minimal_logging's configuration options in application.rb or development.rb in your config.
|
31
31
|
|
32
|
-
|
32
|
+
By default, minimal_logging will change your log_level to :info. If you want to set the log level yourself, you can turn this behavior off.
|
33
33
|
```ruby
|
34
34
|
config.minimal_logging.change_log_level = false
|
35
35
|
```
|
36
36
|
|
37
|
-
|
37
|
+
You can turn logging assets back on. Much of the logic for quietting assets thanks to the [quiet_assets](https://github.com/evrone/quiet_assets) gem.
|
38
|
+
```ruby
|
39
|
+
config.minimal_logging.quiet_assets = false
|
40
|
+
```
|
41
|
+
|
42
|
+
And you can turn off minimal_logging itself.
|
38
43
|
```ruby
|
39
44
|
config.minimal_logging.enabled = false
|
40
45
|
```
|
@@ -1,7 +1,27 @@
|
|
1
1
|
require 'logger'
|
2
2
|
|
3
|
+
ASSETS_REGEX = MinimalLogging.assets_regex
|
3
4
|
Rails::Rack::Logger.class_eval do
|
4
5
|
|
6
|
+
def call_with_quiet_assets(env)
|
7
|
+
old_level = nil
|
8
|
+
|
9
|
+
begin
|
10
|
+
if env['PATH_INFO'] =~ ASSETS_REGEX
|
11
|
+
old_level = Rails.logger.level
|
12
|
+
Rails.logger.level = Logger::ERROR
|
13
|
+
end
|
14
|
+
call_without_quiet_assets(env)
|
15
|
+
ensure
|
16
|
+
Rails.logger.level = old_level if old_level
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
if MinimalLogging.quiet_assets?
|
21
|
+
MinimalLogging.app.config.assets.logger = false
|
22
|
+
alias_method_chain :call, :quiet_assets
|
23
|
+
end
|
24
|
+
|
5
25
|
protected
|
6
26
|
|
7
27
|
def call_app(request, env)
|
@@ -19,7 +39,6 @@ Rails::Rack::Logger.class_eval do
|
|
19
39
|
ActiveSupport::LogSubscriber.flush_all!
|
20
40
|
end
|
21
41
|
|
22
|
-
# GET "/session/new"
|
23
42
|
def started_request_message(request)
|
24
43
|
method = request.request_method.colorize(:blue)
|
25
44
|
path = request.filtered_path.colorize(:magenta)
|
data/lib/minimal_logging.rb
CHANGED
@@ -25,6 +25,16 @@ module MinimalLogging
|
|
25
25
|
def minimal_config
|
26
26
|
app.config.minimal_logging
|
27
27
|
end
|
28
|
+
|
29
|
+
def quiet_assets?
|
30
|
+
minimal_config.quiet_assets
|
31
|
+
end
|
32
|
+
|
33
|
+
def assets_regex
|
34
|
+
paths = app.config.assets.prefix
|
35
|
+
paths = [ %r[\A/{0,2}#{paths}] ]
|
36
|
+
/\A(#{paths.join('|')})/
|
37
|
+
end
|
28
38
|
end
|
29
39
|
|
30
40
|
require 'minimal_logging/railtie' if defined?(Rails)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minimal_logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Nelson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|