denouncer 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -12
- data/lib/denouncer/notifiers/base_notifier.rb +1 -1
- data/lib/denouncer/notifiers/console_notifier.rb +1 -1
- data/lib/denouncer/notifiers/smtp_notifier.rb +19 -1
- data/lib/denouncer/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: f46ec8f7ec7369563a9ed92fa4c141ea8fd5020f
|
4
|
+
data.tar.gz: ba6177043b839d23d0d74a09daf3ab79602b4879
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bce23da2aba61fc51a4a81fbfd80c3423d6eb5e6e71ef3b506f7abc9ba9128faaa31087a04e13f570c0673f215727e2fb0c33d1226f15abb376eefc7ef0409c4
|
7
|
+
data.tar.gz: 1c872175a71bdc5b4275bc5f22242b00817426d0f98c0f5b6cc3c8e4b345ed63156c237e0401ca82969ee1b6341ebec917dfd53a29c4f7eb9a2e32de7779a426
|
data/README.md
CHANGED
@@ -100,18 +100,18 @@ Configuration variables are:
|
|
100
100
|
|
101
101
|
#### AMQP Configuration
|
102
102
|
|
103
|
-
require 'denouncer'
|
104
|
-
|
105
|
-
Denouncer.configure(
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
)
|
103
|
+
require 'denouncer'
|
104
|
+
|
105
|
+
Denouncer.configure(
|
106
|
+
application_name: "my_app",
|
107
|
+
notifier: :amqp,
|
108
|
+
port: 5672,
|
109
|
+
server: "localhost",
|
110
|
+
vhost: "/",
|
111
|
+
username: "guest",
|
112
|
+
password: "guest",
|
113
|
+
message_queue: "my_app.errors"
|
114
|
+
)
|
115
115
|
|
116
116
|
## Usage
|
117
117
|
|
@@ -7,7 +7,7 @@ module Denouncer
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def notify(error, metadata = nil)
|
10
|
-
puts "Timestamp: #{get_current_timestamp}"
|
10
|
+
puts "Timestamp: #{get_current_timestamp.to_s}"
|
11
11
|
puts "Error Class: #{error.class.name}"
|
12
12
|
puts "Error Message: #{error.message}"
|
13
13
|
puts "Metadata: #{metadata.to_s}"
|
@@ -37,10 +37,12 @@ module Denouncer
|
|
37
37
|
def generate_text_message(error, metadata = nil)
|
38
38
|
hostname = Socket.gethostname
|
39
39
|
time_now = get_current_timestamp
|
40
|
+
recipients_list = formatted_recipients
|
40
41
|
msgstr = <<END_OF_MESSAGE
|
41
42
|
From: #{config[:application_name]} <#{config[:sender]}>
|
43
|
+
To: #{recipients_list}
|
42
44
|
Subject: [ERROR] - #{config[:application_name]} - An exception occured
|
43
|
-
Date: #{time_now}
|
45
|
+
Date: #{formatted_time(time_now)}
|
44
46
|
|
45
47
|
Application name:
|
46
48
|
#{config[:application_name]}
|
@@ -69,6 +71,22 @@ END_OF_MESSAGE
|
|
69
71
|
return msgstr
|
70
72
|
end
|
71
73
|
|
74
|
+
def formatted_recipients
|
75
|
+
rec = ""
|
76
|
+
config[:recipients].each_with_index do |r, i|
|
77
|
+
if (i == config[:recipients].length - 1)
|
78
|
+
rec << r
|
79
|
+
else
|
80
|
+
rec << r << ", "
|
81
|
+
end
|
82
|
+
end
|
83
|
+
rec
|
84
|
+
end
|
85
|
+
|
86
|
+
def formatted_time(time)
|
87
|
+
time.strftime("%a, %e %b %Y %H:%M:%S %z")
|
88
|
+
end
|
89
|
+
|
72
90
|
def formatted_backtrace(error)
|
73
91
|
bt = error.backtrace
|
74
92
|
return "No backtrace available!" if bt.nil?
|
data/lib/denouncer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: denouncer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julian Weber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|