sapience 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 361b5d79b5ffabba3d74e3535c5a3dc151519c9c
4
- data.tar.gz: 849dd32570ebb429da8f13119e12470d0b112df2
3
+ metadata.gz: 2171e090ce8a04ee2d96e24e6e68ae617e2855e6
4
+ data.tar.gz: 9babc1421bcf9b6adc12c1a4b6db45646fa2b8fd
5
5
  SHA512:
6
- metadata.gz: b1816579d431aaceea45108f4809cb9fde10ce3e869586f11ff2b6de5e26bac22ca2e5b0c6491680439d04076027360fa7827fc09bf93be300025255609f98f4
7
- data.tar.gz: 9526640b1dead5a858799f0dffa19e397266014e61c3a1418d32b3be9015e50c8ca657737270f8164453e82a58d3de119c58b102d5667007c642e45e676859d0
6
+ metadata.gz: 169fb6071907dbf7c9838c97e862d7f5672ee5071a04bcf0a960d75ddb4e1489b9fe9899e25306e179ca26143f4babafe45ad8f2bca7873358b3849a1d4dd67d
7
+ data.tar.gz: fea5d04f8247186909e3855363310e277e92e245654adcae56195aec046f8994ec99e8d2e50a615f1ae4b2a36476d7fc9b2d2f65eb2e0f82c8eb896829b4fd1b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v0.2.1
2
+
3
+ - Fixed all appenders, it only worked for Sapience::Logger.
4
+ - Added method to test exceptions `Sapience.test_exception(:error)`
5
+
1
6
  ## v0.2.0
2
7
 
3
8
  - Rename Appender::File to Appender::Stream. Accept option stream instead of file in `sapience.yml`
data/README.md CHANGED
@@ -108,6 +108,15 @@ Sapience.add_appender(
108
108
  )
109
109
  ```
110
110
 
111
+ #### Test exceptions
112
+
113
+ If you want to quickly verify that your appenders are handling exceptions properly. You can use the following method to
114
+ generate and log an exception at any given level.
115
+
116
+ ```ruby
117
+ Sapience.test_exception(:error)
118
+ ```
119
+
111
120
  ### Datadog
112
121
 
113
122
  Datadog is a slightly modified version of statsd. On top of the standard statsd API it has support for events.
@@ -107,10 +107,10 @@ module Sapience
107
107
  def log(log, message = nil, progname = nil, &block)
108
108
  # Compatibility with ::Logger
109
109
  return add(log, message, progname, &block) unless log.is_a?(Sapience::Log)
110
- @@appender_thread.post(log) do |log_message|
110
+ @@appender_thread << lambda do
111
111
  Sapience.appenders.each do |appender|
112
112
  begin
113
- appender.log(log_message)
113
+ appender.log(log)
114
114
  rescue StandardError => exc
115
115
  logger.error "Appender thread: Failed to log to appender: #{appender.inspect}", exc
116
116
  end
@@ -225,6 +225,10 @@ module Sapience
225
225
  @@logger ||= Sapience::Logger.logger
226
226
  end
227
227
 
228
+ def self.test_exception(level = :error)
229
+ Sapience[self].public_send(level, Exception.new("Sapience Test Exception"))
230
+ end
231
+
228
232
  # Wait until all queued log messages have been written and flush all active
229
233
  # appenders
230
234
  def self.flush
@@ -1,3 +1,3 @@
1
1
  module Sapience
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sapience
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson