denouncer 0.2.6 → 0.2.7

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: d95418a9137acb057884e81971a32145a509b432
4
- data.tar.gz: 948a25ff7c0b33c5c052680e92c37a3646e6ac11
3
+ metadata.gz: f46ec8f7ec7369563a9ed92fa4c141ea8fd5020f
4
+ data.tar.gz: ba6177043b839d23d0d74a09daf3ab79602b4879
5
5
  SHA512:
6
- metadata.gz: a0a36c92b323d0d1e36bea77dac86858c4330ce5277fa91355071705252403ed64474522a90a7322b3bb583a5ce93ff23675b7cf81a6e09238b5f250f65ad731
7
- data.tar.gz: 968812c48775dc4042e79beeddbd95b990221e30bab0a678f3924029fe25847af4a3b3741fa9712738c413a5cfaeb985787f082ec3197f1e03a60014c1cd11ab
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
- 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
- )
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
 
@@ -15,7 +15,7 @@ module Denouncer
15
15
 
16
16
  # Returns the current timestamp in utc is8601 format
17
17
  def get_current_timestamp
18
- Time.now.utc.iso8601
18
+ Time.now.utc
19
19
  end
20
20
 
21
21
  def set_configuration!(options)
@@ -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?
@@ -1,3 +1,3 @@
1
1
  module Denouncer
2
- VERSION = "0.2.6"
2
+ VERSION = "0.2.7"
3
3
  end
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.6
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-23 00:00:00.000000000 Z
11
+ date: 2015-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler