act-fluent-logger-rails 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/act-fluent-logger-rails/logger.rb +10 -4
- data/lib/act-fluent-logger-rails/version.rb +1 -1
- data/spec/logger_spec.rb +31 -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: fb3b269dca0af21e27b94fe5fc0470ea8368f6d7
|
4
|
+
data.tar.gz: 1d8d7858797a83437b6af1ba5d6c434c31e41c82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ba8d6eb2601eadb7aa8e1f0a91fcd8c9f0fd79c69832d11e66eb72a9b0284d917b6069c132978a4269b29329a0742c01cb99a331f0b6794af7aceb324acb4e7
|
7
|
+
data.tar.gz: a4b00ac33e2140b85f798fdd5e063124b7e31debb1a17213ba51ba68900c38a4d3ef6e5bdabf9605f3c74b415ca0dd0d939b3eb65ccdfa0fb96f4d3e353f7c08
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -61,7 +61,7 @@ or set an environment variable FLUENTD_URL
|
|
61
61
|
* fluent_host: The host name of Fluentd.
|
62
62
|
* fluent_port: The port number of Fluentd.
|
63
63
|
* tag: The tag of the Fluentd event.
|
64
|
-
* messages_type: The type of log
|
64
|
+
* messages_type: The type of log messages. 'string' or 'array'.
|
65
65
|
If it is 'string', the log messages is a String.
|
66
66
|
```
|
67
67
|
2013-01-18T15:04:50+09:00 foo {"messages":"Started GET \"/\" for 127.0.0.1 at 2013-01-18 15:04:49 +0900\nProcessing by TopController#index as HTML\nCompleted 200 OK in 635ms (Views: 479.3ms | ActiveRecord: 39.6ms)"],"level":"INFO"}
|
@@ -75,10 +75,16 @@ module ActFluentLoggerRails
|
|
75
75
|
def add_message(severity, message)
|
76
76
|
@severity = severity if @severity < severity
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
78
|
+
message =
|
79
|
+
case message
|
80
|
+
when ::String
|
81
|
+
message
|
82
|
+
when ::Exception
|
83
|
+
"#{ message.message } (#{ message.class })\n" <<
|
84
|
+
(message.backtrace || []).join("\n")
|
85
|
+
else
|
86
|
+
message.inspect
|
87
|
+
end
|
82
88
|
|
83
89
|
if message.encoding == Encoding::UTF_8
|
84
90
|
@messages << message
|
data/spec/logger_spec.rb
CHANGED
@@ -73,8 +73,15 @@ EOF
|
|
73
73
|
end
|
74
74
|
|
75
75
|
describe 'frozen ascii-8bit string' do
|
76
|
-
|
76
|
+
before do
|
77
77
|
logger.instance_variable_set(:@messages_type, :string)
|
78
|
+
end
|
79
|
+
|
80
|
+
after do
|
81
|
+
logger.instance_variable_set(:@messages_type, :array)
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'join messages' do
|
78
85
|
ascii = "\xe8\x8a\xb1".force_encoding('ascii-8bit').freeze
|
79
86
|
logger.tagged([request]) {
|
80
87
|
logger.info(ascii)
|
@@ -85,6 +92,29 @@ EOF
|
|
85
92
|
end
|
86
93
|
end
|
87
94
|
|
95
|
+
describe 'Exception' do
|
96
|
+
it 'output message, class, backtrace' do
|
97
|
+
begin
|
98
|
+
3 / 0
|
99
|
+
rescue => e
|
100
|
+
logger.tagged([request]) {
|
101
|
+
logger.error(e)
|
102
|
+
}
|
103
|
+
expect(@my_logger.log[0][1][:messages][0]).
|
104
|
+
to match(%r|divided by 0 \(ZeroDivisionError\).*spec/logger_spec\.rb:|m)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe 'Object' do
|
110
|
+
it 'output inspect' do
|
111
|
+
x = Object.new
|
112
|
+
logger.tagged([request]) {
|
113
|
+
logger.info(x)
|
114
|
+
}
|
115
|
+
expect(@my_logger.log[0][1][:messages][0]).to eq(x.inspect)
|
116
|
+
end
|
117
|
+
end
|
88
118
|
end
|
89
119
|
|
90
120
|
describe "use ENV['FLUENTD_URL']" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: act-fluent-logger-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TAHARA Yoshinori
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|