exception_notification_fluent_logger_notifier 0.0.3 → 0.0.9
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/.gitignore +9 -17
- data/LICENSE.txt +21 -0
- data/README.md +4 -52
- data/Rakefile +0 -4
- data/exception_notification_fluent_logger_notifier.gemspec +8 -12
- metadata +12 -89
- data/.travis.yml +0 -5
- data/lib/exception_notification_fluent_logger_notifier.rb +0 -1
- data/lib/exception_notifier/fluent_logger_notifier.rb +0 -75
- data/lib/exception_notifier/fluent_logger_notifier/version.rb +0 -5
- data/spec/exception_notifier/fluent_logger_notifier_spec.rb +0 -107
- data/spec/spec_helper.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fde8abea92eaa814390b59411963389194ddb48e
|
4
|
+
data.tar.gz: 1a969938ce940bbafb3c95b8c0cbda03b1103d83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6b02704fd431bc1a52fae790638df098c7ee0415bad07b4564be99eaab4fb62945c8d5ac8592727c3edc9b2ad12b8768669a819b84fe821cd672cc9dea0c848
|
7
|
+
data.tar.gz: 0e42e6ce346c15d1817a74d0880c1398e153958e60895ae2c1d3a4786a758d227760e471d1d7f75820b57c2957c1ef6ae6879ee74a18bb2eb5b29e2e9d0b0a53
|
data/.gitignore
CHANGED
@@ -1,17 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Shimpei Makimoto
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,57 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# exception\_notification\_fluent\_logger\_notifier
|
2
2
|
|
3
|
-
|
4
|
-
It sends exception notifications to [Fluentd data collector](http://fluentd.org/) via [fluent-logger](https://github.com/fluent/fluent-logger-ruby).
|
3
|
+
**[DEPRECATION]**
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
Add this line to your application's Gemfile:
|
9
|
-
|
10
|
-
gem 'exception_notification_fluent_logger_notifier'
|
11
|
-
|
12
|
-
And then execute:
|
13
|
-
|
14
|
-
$ bundle
|
15
|
-
|
16
|
-
Or install it yourself as:
|
17
|
-
|
18
|
-
$ gem install exception_notification_fluent_logger_notifier
|
19
|
-
|
20
|
-
## Usage
|
21
|
-
|
22
|
-
As other exception notifiers, add settings at the environments.
|
23
|
-
|
24
|
-
* Key `tag_prefix` is for the fluentd tag.
|
25
|
-
* Key `template` is for setting log format and must be Hash.
|
26
|
-
* Key `logger_settings` is for settings of the logger instance.
|
27
|
-
* If key `test_logger` is `true`, the notifier uses `Fluent::Logger::TestLogger` instead of `FluentLogger`.
|
28
|
-
|
29
|
-
See also [exception_notifier's doc](http://smartinez87.github.io/exception_notification/#notifiers).
|
30
|
-
|
31
|
-
### Example
|
32
|
-
|
33
|
-
```ruby
|
34
|
-
Whatever::Application.config.middleware.use ExceptionNotification::Rack,
|
35
|
-
fluent_logger: {
|
36
|
-
tag_prefix: "exceptions",
|
37
|
-
logger_settings: {
|
38
|
-
host: "localhost",
|
39
|
-
port: 8888,
|
40
|
-
}
|
41
|
-
template: {
|
42
|
-
exception_class: ->(exception, options) { exception.class_name },
|
43
|
-
exception_message: => -> (exception, options) { exception.messaage },
|
44
|
-
}
|
45
|
-
}
|
46
|
-
```
|
47
|
-
|
48
|
-
## Contributing
|
49
|
-
|
50
|
-
1. Fork it
|
51
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
52
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
53
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
54
|
-
5. Create new Pull Request
|
5
|
+
The gem 'exception\_notification\_fluent\_logger\_notifier' has been renamed to [exception\_notification\-fluent\_logger\_notifier](https://github.com/makimoto/exception_notification-fluent_logger_notifier).
|
6
|
+
Please use it instead.
|
55
7
|
|
56
8
|
## License
|
57
9
|
|
data/Rakefile
CHANGED
@@ -1,26 +1,22 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "exception_notifier/fluent_logger_notifier/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
6
|
spec.name = "exception_notification_fluent_logger_notifier"
|
8
|
-
spec.version =
|
7
|
+
spec.version = '0.0.9'
|
9
8
|
spec.authors = ["Shimpei Makimoto"]
|
10
9
|
spec.email = ["makimoto@tsuyabu.in"]
|
11
|
-
|
10
|
+
|
11
|
+
spec.summary = %q{[DEPRECATED] old gem of exception_notification-fluent_logger_notifier}
|
12
12
|
spec.homepage = "https://github.com/makimoto/exception_notification_fluent_logger_notifier"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
|
-
spec.files = `git ls-files`.split(
|
16
|
-
spec.
|
17
|
-
spec.
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = "exe"
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.
|
21
|
-
spec.
|
22
|
-
spec.add_development_dependency "rspec"
|
23
|
-
spec.add_development_dependency "pry"
|
24
|
-
spec.add_dependency "exception_notification", "~> 4.0.1"
|
25
|
-
spec.add_dependency "fluent-logger"
|
20
|
+
spec.add_dependency "exception_notification-fluent_logger_notifier", "~> 0.1.0"
|
21
|
+
spec.post_install_message = "[DEPRECATION WARNING] This gem has been renamed to 'exception_notification-fluent_logger_notifier' and will no longer be supported."
|
26
22
|
end
|
metadata
CHANGED
@@ -1,99 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exception_notification_fluent_logger_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shimpei Makimoto
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: exception_notification-fluent_logger_notifier
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '1.3'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: pry
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: exception_notification
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 4.0.1
|
19
|
+
version: 0.1.0
|
76
20
|
type: :runtime
|
77
21
|
prerelease: false
|
78
22
|
version_requirements: !ruby/object:Gem::Requirement
|
79
23
|
requirements:
|
80
24
|
- - "~>"
|
81
25
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: fluent-logger
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
26
|
+
version: 0.1.0
|
97
27
|
description:
|
98
28
|
email:
|
99
29
|
- makimoto@tsuyabu.in
|
@@ -102,21 +32,17 @@ extensions: []
|
|
102
32
|
extra_rdoc_files: []
|
103
33
|
files:
|
104
34
|
- ".gitignore"
|
105
|
-
- ".travis.yml"
|
106
35
|
- Gemfile
|
36
|
+
- LICENSE.txt
|
107
37
|
- README.md
|
108
38
|
- Rakefile
|
109
39
|
- exception_notification_fluent_logger_notifier.gemspec
|
110
|
-
- lib/exception_notification_fluent_logger_notifier.rb
|
111
|
-
- lib/exception_notifier/fluent_logger_notifier.rb
|
112
|
-
- lib/exception_notifier/fluent_logger_notifier/version.rb
|
113
|
-
- spec/exception_notifier/fluent_logger_notifier_spec.rb
|
114
|
-
- spec/spec_helper.rb
|
115
40
|
homepage: https://github.com/makimoto/exception_notification_fluent_logger_notifier
|
116
41
|
licenses:
|
117
42
|
- MIT
|
118
43
|
metadata: {}
|
119
|
-
post_install_message:
|
44
|
+
post_install_message: "[DEPRECATION WARNING] This gem has been renamed to 'exception_notification-fluent_logger_notifier'
|
45
|
+
and will no longer be supported."
|
120
46
|
rdoc_options: []
|
121
47
|
require_paths:
|
122
48
|
- lib
|
@@ -132,11 +58,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
58
|
version: '0'
|
133
59
|
requirements: []
|
134
60
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
61
|
+
rubygems_version: 2.5.1
|
136
62
|
signing_key:
|
137
63
|
specification_version: 4
|
138
|
-
summary:
|
139
|
-
|
140
|
-
test_files:
|
141
|
-
- spec/exception_notifier/fluent_logger_notifier_spec.rb
|
142
|
-
- spec/spec_helper.rb
|
64
|
+
summary: "[DEPRECATED] old gem of exception_notification-fluent_logger_notifier"
|
65
|
+
test_files: []
|
data/.travis.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "exception_notifier/fluent_logger_notifier"
|
@@ -1,75 +0,0 @@
|
|
1
|
-
require "fluent-logger"
|
2
|
-
module ExceptionNotifier
|
3
|
-
class FluentLoggerNotifier
|
4
|
-
|
5
|
-
attr_accessor :logger, :template
|
6
|
-
class ConfigurationError < Exception;end
|
7
|
-
|
8
|
-
def initialize(options)
|
9
|
-
@template = options.delete(:template)
|
10
|
-
raise ConfigurationError, "`template` key must be set" unless @template
|
11
|
-
|
12
|
-
logger_settings = options.delete(:logger_settings) || {}
|
13
|
-
if options.delete(:test_logger)
|
14
|
-
@logger = Fluent::Logger::TestLogger.new
|
15
|
-
else
|
16
|
-
tag_prefix = options.delete(:tag_prefix)
|
17
|
-
@logger = Fluent::Logger::FluentLogger.new(tag_prefix, logger_settings)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def call(exception, options={})
|
22
|
-
arg = Argument.build(template, exception, options)
|
23
|
-
logger.post(nil, arg)
|
24
|
-
end
|
25
|
-
|
26
|
-
class SetupError < Exception;end
|
27
|
-
|
28
|
-
class Argument
|
29
|
-
def initialize(template, exception, options = {})
|
30
|
-
@exception = exception
|
31
|
-
@options = options
|
32
|
-
@template = template
|
33
|
-
end
|
34
|
-
|
35
|
-
def build
|
36
|
-
expand_object(@template)
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.build(template, exception, options = {})
|
40
|
-
self.new(template, exception, options).build
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
def expand_object(obj)
|
46
|
-
case obj
|
47
|
-
when Hash
|
48
|
-
expand_hash(obj)
|
49
|
-
when Array
|
50
|
-
expand_array(obj)
|
51
|
-
when Proc
|
52
|
-
expand_proc(obj)
|
53
|
-
else
|
54
|
-
obj
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def expand_proc(prok)
|
59
|
-
expand_object(prok.call(@exception, @options))
|
60
|
-
end
|
61
|
-
|
62
|
-
def expand_array(array)
|
63
|
-
array.map {|element| expand_object(element) }
|
64
|
-
end
|
65
|
-
|
66
|
-
def expand_hash(hash)
|
67
|
-
{}.tap do |result|
|
68
|
-
hash.each do |k, v|
|
69
|
-
result[k] = expand_object(v)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,107 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe ExceptionNotifier::FluentLoggerNotifier do
|
4
|
-
class FooException < Exception;end
|
5
|
-
|
6
|
-
let(:exception) do
|
7
|
-
FooException.new("bar message")
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:notifier) do
|
11
|
-
ExceptionNotifier::FluentLoggerNotifier.new(
|
12
|
-
test_logger: true,
|
13
|
-
logger_settings: {
|
14
|
-
:host => "localhost",
|
15
|
-
:port => 8888,
|
16
|
-
},
|
17
|
-
template: {
|
18
|
-
message: ->(exception, options) { "Exception: #{exception.class}: #{exception.message}" }
|
19
|
-
}
|
20
|
-
)
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "#call" do
|
24
|
-
it "logs valid data" do
|
25
|
-
notifier.call(FooException.new("bar message"))
|
26
|
-
notifier.logger.queue.last.should == { message: "Exception: FooException: bar message" }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe ExceptionNotifier::FluentLoggerNotifier::Argument do
|
31
|
-
subject do
|
32
|
-
ExceptionNotifier::FluentLoggerNotifier::Argument.build(template, exception, {})
|
33
|
-
end
|
34
|
-
|
35
|
-
context "with String" do
|
36
|
-
let(:template) do
|
37
|
-
"string"
|
38
|
-
end
|
39
|
-
|
40
|
-
it "returns string without any change" do
|
41
|
-
should == "string"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
context "with Proc" do
|
46
|
-
let(:template) do
|
47
|
-
->(e, opts) { "Exception: #{e.class}: #{e.message}" }
|
48
|
-
end
|
49
|
-
|
50
|
-
it "returns intended string" do
|
51
|
-
should == "Exception: FooException: bar message"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
context "with Hash" do
|
56
|
-
let(:template) do
|
57
|
-
{
|
58
|
-
class_name: ->(e, opts) { e.class.to_s },
|
59
|
-
message: ->(e, opts) { e.message},
|
60
|
-
baz: 42,
|
61
|
-
}
|
62
|
-
end
|
63
|
-
|
64
|
-
it "returns intended hash" do
|
65
|
-
should == { class_name: "FooException", message: "bar message", baz: 42 }
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
context "with Array" do
|
70
|
-
let(:template) do
|
71
|
-
[
|
72
|
-
->(e, opts) { 1 + 42 },
|
73
|
-
->(e, opts) { e.class.to_s },
|
74
|
-
nil,
|
75
|
-
]
|
76
|
-
end
|
77
|
-
|
78
|
-
it "returns intended array" do
|
79
|
-
[43, "FooException", nil]
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
context "with nested templates" do
|
84
|
-
let(:template) do
|
85
|
-
{
|
86
|
-
string: "string",
|
87
|
-
int: 42,
|
88
|
-
hash: {
|
89
|
-
proc: ->(e, opts) { e.class.to_s }
|
90
|
-
},
|
91
|
-
array: [42, ->(e, opts) { e.message }],
|
92
|
-
}
|
93
|
-
end
|
94
|
-
|
95
|
-
it "returns intended value" do
|
96
|
-
{
|
97
|
-
string: "string",
|
98
|
-
int: 42,
|
99
|
-
hash: {
|
100
|
-
proc: "FooException",
|
101
|
-
},
|
102
|
-
array: [42, "bar message"],
|
103
|
-
}
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
data/spec/spec_helper.rb
DELETED