minimal_logging 0.0.7 → 0.0.8
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cdb00eda7c4164f773b88c9e71b1bbbfe83d9da
|
4
|
+
data.tar.gz: f1f84be191b8923fadda12ce1b641963a272949a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 498ecf191c109e067b66cbddfdf6fc86745d2f4268a6bd75f0e49feb4868e3cbfe7797a061e2a78774314cab78e852a4eea902e0867104ba14212d48bab52d8a
|
7
|
+
data.tar.gz: fb09362a3691d132775276673a9d1d4e6a24a61be1d93211cd157fbcd64ed71fc7c437200f666ebcc52e9fea6635165f5621483b68f3b6b3fbcfe6046dcc4b1e
|
@@ -36,20 +36,7 @@ class ActionController::LogSubscriber
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def format_message(status)
|
39
|
-
|
40
|
-
color_status(status, :green)
|
41
|
-
elsif status < 400
|
42
|
-
color_status(status, :yellow)
|
43
|
-
elsif status < 500
|
44
|
-
color_status(status, :red)
|
45
|
-
elsif status < 600
|
46
|
-
color_status(status, :light_red)
|
47
|
-
else
|
48
|
-
status.to_s
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def color_status(status, color)
|
39
|
+
color = MinimalLogging.color_codes[status / 100]
|
53
40
|
status.to_s.colorize(color)
|
54
41
|
end
|
55
42
|
end
|
data/lib/minimal_logging.rb
CHANGED
@@ -4,9 +4,11 @@ module MinimalLogging
|
|
4
4
|
|
5
5
|
class << self
|
6
6
|
attr_accessor :app
|
7
|
+
attr_accessor :color_codes
|
7
8
|
|
8
9
|
def setup(app)
|
9
10
|
self.app = app
|
11
|
+
self.color_codes = make_color_codes
|
10
12
|
set_log_level
|
11
13
|
apply_log_filters
|
12
14
|
end
|
@@ -35,6 +37,16 @@ module MinimalLogging
|
|
35
37
|
paths = [ %r[\A/{0,2}#{paths}] ]
|
36
38
|
/\A(#{paths.join('|')})/
|
37
39
|
end
|
40
|
+
|
41
|
+
def make_color_codes
|
42
|
+
color_hash = {}
|
43
|
+
color_hash[1] = color_hash[2] = :green
|
44
|
+
color_hash[3] = :yellow
|
45
|
+
color_hash[4] = :red
|
46
|
+
color_hash[5] = :light_red
|
47
|
+
|
48
|
+
color_hash
|
49
|
+
end
|
38
50
|
end
|
39
51
|
|
40
52
|
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.8
|
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-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|