ougai 1.5.3 → 1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ougai/formatters/readable.rb +19 -10
- data/lib/ougai/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: 97be7511c1c17536603cf512a2f8c107e40ff021
|
4
|
+
data.tar.gz: e2c08a3c8e6833e0ef2622d0fb264b75dba77e94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d457ca8fbff8a3a22003eb9c4878b7b0af931a04d58d89f950733ab80a22de0095f5ee5a16d4c6f8b7695d327434ea12c9629710656df3a32c9543bf1de5c39b
|
7
|
+
data.tar.gz: '0974027ba5cd59d0e8418abb5a2e5b89ee0145cd7cf002d9ea497c871b4c2305952ac3bf56bb06ac5298eb5d8b74f20e2d674aacd8d62e5081861aa4fc853dc8'
|
@@ -14,20 +14,26 @@ module Ougai
|
|
14
14
|
@trace_indent = opts[:trace_indent] || 4
|
15
15
|
@plain = opts[:plain] || false
|
16
16
|
@excluded_fields = opts[:excluded_fields] || []
|
17
|
-
|
17
|
+
load_dependent
|
18
18
|
end
|
19
19
|
|
20
20
|
def call(severity, time, progname, data)
|
21
21
|
msg = data.delete(:msg)
|
22
22
|
level = @plain ? severity : colored_level(severity)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
23
|
+
dt = format_datetime(time)
|
24
|
+
err_str = create_err_str(data)
|
25
|
+
|
27
26
|
@excluded_fields.each { |f| data.delete(f) }
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
data_str = create_data_str(data)
|
28
|
+
format_log_parts(dt, level, msg, err_str, data_str)
|
29
|
+
end
|
30
|
+
|
31
|
+
protected
|
32
|
+
|
33
|
+
def format_log_parts(datetime, level, msg, err, data)
|
34
|
+
strs = ["[#{datetime}] #{level}: #{msg}"]
|
35
|
+
strs.push(err) if err
|
36
|
+
strs.push(data) if data
|
31
37
|
strs.join("\n") + "\n"
|
32
38
|
end
|
33
39
|
|
@@ -59,9 +65,12 @@ module Ougai
|
|
59
65
|
err_str
|
60
66
|
end
|
61
67
|
|
62
|
-
|
68
|
+
def create_data_str(data)
|
69
|
+
return nil if data.empty?
|
70
|
+
data.ai({ plain: @plain })
|
71
|
+
end
|
63
72
|
|
64
|
-
def
|
73
|
+
def load_dependent
|
65
74
|
require 'awesome_print'
|
66
75
|
rescue LoadError
|
67
76
|
puts 'You must install the awesome_print gem to use this output.'
|
data/lib/ougai/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ougai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toshimitsu Takahashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|