semantic_logger 2.14.0 → 2.15.0
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/README.md +28 -5
- data/lib/semantic_logger/appender/bugsnag.rb +6 -3
- data/lib/semantic_logger/base.rb +4 -1
- data/lib/semantic_logger/version.rb +1 -1
- data/test/appender_bugsnag_test.rb +5 -6
- data/test/appender_file_test.rb +6 -2
- data/test/appender_mongodb_test.rb +1 -2
- data/test/appender_new_relic_test.rb +2 -1
- data/test/appender_splunk_test.rb +1 -2
- data/test/appender_syslog_test.rb +1 -2
- data/test/appender_wrapper_test.rb +1 -2
- data/test/debug_as_trace_logger_test.rb +1 -2
- data/test/loggable_test.rb +1 -2
- data/test/logger_test.rb +1 -2
- data/test/test_helper.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdbe70622c40bdf8a20fc8279e22c21085d8279a
|
4
|
+
data.tar.gz: f66fcd67a69b00d452e1fa3c978e59fb6d7bf591
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17f5b1e431295b2ca8c11df91be4b0c0e3b0a6e05a8b688d27ddf56a6b88c6484f15e2a03b692d1c49e15cb0ff2243a727d2ed66ead6fb4533029473c117bc40
|
7
|
+
data.tar.gz: 7fbe8f81f9122e6ffe4271314216b70aab44480bfb2a220d3c60a3534e9f55a55a9e2f80ec2f2645de2e4663332a4675d30e4cedff8543f95504fcbd613ab9a7
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
semantic_logger [](http://travis-ci.org/reidmorrison/semantic_logger)
|
1
|
+
semantic_logger [](http://travis-ci.org/reidmorrison/semantic_logger) 
|
2
2
|
===============
|
3
3
|
|
4
|
-
|
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: [](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
|
17
|
-
- Ruby
|
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
|
-
{ :
|
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
|
81
|
+
return 'warning' if log.level == :warn
|
82
|
+
log.level.to_s
|
80
83
|
end
|
81
84
|
end
|
data/lib/semantic_logger/base.rb
CHANGED
@@ -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 &&
|
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,5 +1,4 @@
|
|
1
|
-
|
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
|
data/test/appender_file_test.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
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
|
data/test/loggable_test.rb
CHANGED
data/test/logger_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
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.
|
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-
|
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.
|
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
|