semantic_logger 2.14.0 → 2.15.0

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: 3a000244f5570ff32c8dcc923f066a131abd7cb0
4
- data.tar.gz: a9471ed620e7408a195a9292f41730c68ea54e98
3
+ metadata.gz: cdbe70622c40bdf8a20fc8279e22c21085d8279a
4
+ data.tar.gz: f66fcd67a69b00d452e1fa3c978e59fb6d7bf591
5
5
  SHA512:
6
- metadata.gz: 0667f6ef71190a16d66849493630a43f7dce3e8ae2786b38972f84b992cf3f2081995eb4e01c0d72ee47e0b378b49d844dd5883b561db40831f28d20abbff053
7
- data.tar.gz: d81cddd57a426da87b14b4df0b2b212926e0c5b8405be8d103aa518348d4f65f0d8689bf066b6cf189d85e704b77c9929e874fbe6be9318579e6f6651ee85159
6
+ metadata.gz: 17f5b1e431295b2ca8c11df91be4b0c0e3b0a6e05a8b688d27ddf56a6b88c6484f15e2a03b692d1c49e15cb0ff2243a727d2ed66ead6fb4533029473c117bc40
7
+ data.tar.gz: 7fbe8f81f9122e6ffe4271314216b70aab44480bfb2a220d3c60a3534e9f55a55a9e2f80ec2f2645de2e4663332a4675d30e4cedff8543f95504fcbd613ab9a7
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- semantic_logger [![Build Status](https://secure.travis-ci.org/reidmorrison/semantic_logger.png?branch=master)](http://travis-ci.org/reidmorrison/semantic_logger)
1
+ semantic_logger [![Build Status](https://secure.travis-ci.org/reidmorrison/semantic_logger.png?branch=master)](http://travis-ci.org/reidmorrison/semantic_logger) ![](http://ruby-gem-downloads-badge.herokuapp.com/semantic_logger?type=total)
2
2
  ===============
3
3
 
4
- Next generation logging system for Ruby to support highly concurrent, high throughput, low latency systems
4
+ Low latency, high throughput, enterprise-scale logging system for Ruby
5
5
 
6
6
  * http://github.com/reidmorrison/semantic_logger
7
7
 
@@ -11,15 +11,38 @@ Next generation logging system for Ruby to support highly concurrent, high throu
11
11
 
12
12
  API Documentation: [![semantic_logger API Documentation](https://www.omniref.com/ruby/gems/semantic_logger.png)](https://www.omniref.com/ruby/gems/semantic_logger)
13
13
 
14
+ ## Supports
15
+
16
+ Logging to the following destinations are all supported "out-of-the-box":
17
+
18
+ * File
19
+ * Screen
20
+ * MongoDB
21
+ * BugSnag
22
+ * NewRelic
23
+ * Splunk
24
+ * Syslog
25
+ * Roll-your-own
26
+
27
+ Semantic Logger is capable of logging thousands of lines per second without slowing
28
+ down the application. Traditional logging systems make the application wait while
29
+ the log information is being saved. Semantic Logger avoids this slowdown by pushing
30
+ log events to an in-memory queue that is serviced by a separate thread that only
31
+ handles saving log information to multiple destinations at the same time.
32
+
14
33
  ## Dependencies
15
34
 
16
- Semantic Logger supports the following Ruby platforms:
17
- - Ruby 1.9.3, 2.x
18
- - JRuby 1.7
35
+ Semantic Logger is tested and supported on the following Ruby platforms:
36
+ - Ruby 2.0 and above
37
+ - JRuby 1.7 and above
38
+ - JRuby 9.0.0.0 and above
39
+ - Rubinius 2.5 and above
19
40
 
20
41
  The following gems are only required when their corresponding appenders are being used,
21
42
  and are therefore not automatically included by this gem:
43
+ - Bugsnag Appender: gem 'bugsnag'
22
44
  - MongoDB Appender: gem 'mongo' 1.9.2 or above
45
+ - NewRelic Appender: gem 'newrelic_rpm'
23
46
  - Syslog Appender: gem 'syslog_protocol' 0.9.2 or above
24
47
  - Syslog Appender to a remote syslogng server over TCP or UDP: gem 'net_tcp_client'
25
48
  - Splunk Appender: gem 'splunk-sdk-ruby'
@@ -54,7 +54,9 @@ class SemanticLogger::Appender::Bugsnag < SemanticLogger::Appender::Base
54
54
  # Returns [Hash] of parameters to send to Bugsnag.
55
55
  def default_formatter
56
56
  proc do |log|
57
- { :severity => log_level(log), tags: log.tags }.merge(log.payload || {})
57
+ h = { severity: log_level(log), tags: log.tags }
58
+ h.merge!(log.payload) if log.payload
59
+ h
58
60
  end
59
61
  end
60
62
 
@@ -69,13 +71,14 @@ class SemanticLogger::Appender::Bugsnag < SemanticLogger::Appender::Base
69
71
 
70
72
  # For more documentation on the Bugsnag.notify method see:
71
73
  # https://bugsnag.com/docs/notifiers/ruby#sending-handled-exceptions
72
- Bugsnag.notify(log.exception || log.message, formatter.call(log))
74
+ Bugsnag.notify(log.exception || RuntimeError.new(log.message), formatter.call(log))
73
75
  true
74
76
  end
75
77
 
76
78
  private
77
79
 
78
80
  def log_level(log)
79
- log.level.to_s.gsub('warn', 'warning')
81
+ return 'warning' if log.level == :warn
82
+ log.level.to_s
80
83
  end
81
84
  end
@@ -329,7 +329,10 @@ module SemanticLogger
329
329
 
330
330
  # Log message at the specified level
331
331
  def log_internal(level, index, message=nil, payload=nil, exception=nil, &block)
332
- if exception.nil? && payload && payload.is_a?(Exception)
332
+ if exception.nil? && payload.nil? && message.kind_of?(Exception)
333
+ exception = message
334
+ message = exception.inspect
335
+ elsif exception.nil? && payload && payload.is_a?(Exception)
333
336
  exception = payload
334
337
  payload = nil
335
338
  end
@@ -1,3 +1,3 @@
1
1
  module SemanticLogger #:nodoc
2
- VERSION = "2.14.0"
2
+ VERSION = "2.15.0"
3
3
  end
@@ -1,5 +1,4 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__)
2
- require 'test_helper'
1
+ require_relative 'test_helper'
3
2
 
4
3
  # Unit Test for SemanticLogger::Appender::Bugsnag
5
4
  #
@@ -26,7 +25,7 @@ class AppenderBugsnagTest < Minitest::Test
26
25
  Bugsnag.stub(:notify, -> msg, h { message = msg; hash = h }) do
27
26
  @appender.error @message
28
27
  end
29
- assert_equal @message, message
28
+ assert_equal RuntimeError.new(@message), message
30
29
  assert_equal 'error', hash[:severity]
31
30
  end
32
31
 
@@ -35,7 +34,7 @@ class AppenderBugsnagTest < Minitest::Test
35
34
  Bugsnag.stub(:notify, -> msg, h { message = msg; hash = h }) do
36
35
  @appender.warn @message
37
36
  end
38
- assert_equal @message, message
37
+ assert_equal RuntimeError.new(@message), message
39
38
  assert_equal 'warning', hash[:severity]
40
39
  end
41
40
 
@@ -44,14 +43,14 @@ class AppenderBugsnagTest < Minitest::Test
44
43
  Bugsnag.stub(:notify, -> msg, h { message = msg; hash = h }) do
45
44
  @appender.error @message, {:key1 => 1, :key2 => 'a'}
46
45
  end
47
- assert_equal @message, message
46
+ assert_equal RuntimeError.new(@message), message
48
47
  assert_equal(1, hash[:key1], hash)
49
48
  assert_equal('a', hash[:key2], hash)
50
49
  end
51
50
 
52
51
  should 'send notification to Bugsnag with exception' do
53
52
  message = hash = nil
54
- error = RuntimeError
53
+ error = RuntimeError.new('Hello World')
55
54
  Bugsnag.stub(:notify, -> msg, h { message = msg; hash = h }) do
56
55
  @appender.error error
57
56
  end
@@ -1,5 +1,4 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__)
2
- require 'test_helper'
1
+ require_relative 'test_helper'
3
2
  require 'stringio'
4
3
 
5
4
  # Unit Test for SemanticLogger::Appender::File
@@ -36,6 +35,11 @@ class AppenderFileTest < Minitest::Test
36
35
  @appender.debug 'hello world', @hash, StandardError.new("StandardError")
37
36
  assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ D \[\d+:#{@thread_name}\] SemanticLogger::Appender::File -- hello world -- #{@hash_str} -- Exception: StandardError: StandardError\n\n/, @io.string
38
37
  end
38
+
39
+ should "handle exception only" do
40
+ @appender.debug StandardError.new("StandardError")
41
+ assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ D \[\d+:#{@thread_name}\] SemanticLogger::Appender::File -- #<StandardError: StandardError> -- Exception: StandardError: StandardError\n\n/, @io.string
42
+ end
39
43
  end
40
44
 
41
45
  context "for each log level" do
@@ -1,5 +1,4 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__)
2
- require 'test_helper'
1
+ require_relative 'test_helper'
3
2
 
4
3
  # Unit Test for SemanticLogger::Appender::MongoDB
5
4
  #
@@ -1,5 +1,6 @@
1
+ # So that the NewRelic appender will load the mock
1
2
  $LOAD_PATH.unshift File.dirname(__FILE__)
2
- require 'test_helper'
3
+ require_relative 'test_helper'
3
4
 
4
5
  # Unit Test for SemanticLogger::Appender::NewRelic
5
6
  #
@@ -1,5 +1,4 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__)
2
- require 'test_helper'
1
+ require_relative 'test_helper'
3
2
 
4
3
  # Unit Test for SemanticLogger::Appender::Splunk
5
4
  #
@@ -1,5 +1,4 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__)
2
- require 'test_helper'
1
+ require_relative 'test_helper'
3
2
  require 'net/tcp_client'
4
3
 
5
4
  # Unit Test for SemanticLogger::Appender::Syslog
@@ -1,5 +1,4 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__)
2
- require 'test_helper'
1
+ require_relative 'test_helper'
3
2
 
4
3
  # Unit Test for SemanticLogger::Appender::Wrapper
5
4
  #
@@ -1,5 +1,4 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__)
2
- require 'test_helper'
1
+ require_relative 'test_helper'
3
2
 
4
3
  # Unit Test for SemanticLogger::Logger
5
4
  class DebugAsTraceLoggerTest < Minitest::Test
@@ -1,5 +1,4 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__)
2
- require 'test_helper'
1
+ require_relative 'test_helper'
3
2
  require 'stringio'
4
3
 
5
4
  class TestAttribute
data/test/logger_test.rb CHANGED
@@ -1,5 +1,4 @@
1
- $LOAD_PATH.unshift File.dirname(__FILE__)
2
- require 'test_helper'
1
+ require_relative 'test_helper'
3
2
 
4
3
  # Unit Test for SemanticLogger::Logger
5
4
  class LoggerTest < Minitest::Test
data/test/test_helper.rb CHANGED
@@ -10,6 +10,6 @@ require 'minitest/stub_any_instance'
10
10
  require 'shoulda/context'
11
11
  require 'semantic_logger'
12
12
  require 'logger'
13
- require 'mock_logger'
13
+ require_relative 'mock_logger'
14
14
 
15
15
  Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semantic_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.0
4
+ version: 2.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-10 00:00:00.000000000 Z
11
+ date: 2015-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sync_attr
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  requirements: []
101
101
  rubyforge_project:
102
- rubygems_version: 2.4.6
102
+ rubygems_version: 2.4.8
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Scalable, next generation enterprise logging for Ruby