newrelic_logger_extension 0.0.1 → 0.0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4e26b56101bee5849dff6a54f64172fb8d7d677
|
4
|
+
data.tar.gz: e3af46970e4142fc551dabb0977446091be63d62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72c673790d42cfa86ae9dda835750bfb95d3bed6366b804ac2048ec4cec666d19b88c74f0ca19348c17bbf4b138005f02d913c8a40f54d706d436f6e05841f17
|
7
|
+
data.tar.gz: 14c6128a692e93c35c181643db3d13e3e7bea2a65543a35fc597eb975ce552471b2db6962ca1d4955d58326f0f799575035d7239d00b0754fe1c13282c2bff0a
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'newrelic_logger_extension/version'
|
2
|
+
require 'binding_of_caller'
|
2
3
|
# require 'newrelic_rpm'
|
3
4
|
|
4
5
|
module NewrelicLoggerExtension
|
@@ -12,7 +13,7 @@ module NewrelicLoggerExtension
|
|
12
13
|
logger.singleton_class.class_eval do
|
13
14
|
define_method("#{level}_with_newrelic") do |*args|
|
14
15
|
send("#{level}_without_newrelic", *args)
|
15
|
-
log_to_newrelic
|
16
|
+
log_to_newrelic level.capitalize, binding.of_caller(1).eval('self')
|
16
17
|
end
|
17
18
|
|
18
19
|
alias_method "#{level}_without_newrelic", level
|
@@ -21,14 +22,9 @@ module NewrelicLoggerExtension
|
|
21
22
|
end
|
22
23
|
def self.inject_shared_methods(logger)
|
23
24
|
logger.singleton_class.class_eval do
|
24
|
-
def log_to_newrelic(category,
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
def format_caller(kaller)
|
29
|
-
(kaller.path.split(/\/|\./)[-4..-2] << kaller.lineno).join(SEPARATOR)
|
30
|
-
rescue
|
31
|
-
File.basename(kaller.path)
|
25
|
+
def log_to_newrelic(category, caller_class)
|
26
|
+
caller_class = caller_class.class unless caller_class.class.to_s == 'Class'
|
27
|
+
::NewRelic::Agent.increment_metric("Custom/#{category}/#{caller_class}")
|
32
28
|
end
|
33
29
|
end
|
34
30
|
end
|
@@ -28,7 +28,7 @@ describe NewrelicLoggerExtension do
|
|
28
28
|
it 'should call correctly set the custom metric nameing' do
|
29
29
|
expect(::NewRelic::Agent)
|
30
30
|
.to receive(:increment_metric)
|
31
|
-
.with('Custom/Warn/
|
32
|
-
logger.warn('test warning')
|
31
|
+
.with('Custom/Warn/RSpec::ExampleGroups::NewrelicLoggerExtension')
|
32
|
+
logger.warn('test warning')
|
33
33
|
end
|
34
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_logger_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Eger
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: binding_of_caller
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.7'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.7'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|