scout_apm_logging 0.0.3 → 0.0.4
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/CHANGELOG.md +3 -0
- data/lib/scout_apm/logging/loggers/formatter.rb +8 -9
- data/lib/scout_apm/logging/version.rb +1 -1
- data/spec/integration/rails/lifecycle_spec.rb +5 -0
- data/spec/rails/app.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a99a84cd9f8dd023b8717c81e5d80b17c99f5afb8c7e7edb6152193ef7fecdf
|
4
|
+
data.tar.gz: b9d2e44b40adcb5f9acc13f6ef6d2176e79ed6b056f6e6d1e8f9f0359857ebf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f73329ada6fde049cf1ffe18ad2d43c0fa09158cffcc10e51c58f897d9cd40f1aa2636ee645e2b26d7a36204e082ca318c5281e8e32759aaac2b685a4ff5f32
|
7
|
+
data.tar.gz: 664471524c4802ad23cfeee6299a56259d07e7a9a9d2fb241393202b4116946052f695982ada22c3060a39fca25f351ce6a90487e329283bc264749e6ee56738
|
data/CHANGELOG.md
CHANGED
@@ -12,12 +12,15 @@ module ScoutApm
|
|
12
12
|
class Formatter < ::Logger::Formatter
|
13
13
|
DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%LZ'
|
14
14
|
|
15
|
-
def call(severity, time, progname, msg)
|
16
|
-
attributes_to_log
|
17
|
-
|
15
|
+
def call(severity, time, progname, msg)
|
16
|
+
attributes_to_log = {
|
17
|
+
severity: severity,
|
18
|
+
time: format_datetime(time),
|
19
|
+
pid: Process.pid.to_s,
|
20
|
+
msg: msg2str(msg)
|
21
|
+
}
|
22
|
+
|
18
23
|
attributes_to_log[:progname] = progname if progname
|
19
|
-
attributes_to_log[:pid] = Process.pid.to_s
|
20
|
-
attributes_to_log[:msg] = msg2str(msg)
|
21
24
|
attributes_to_log['service.name'] = service_name
|
22
25
|
|
23
26
|
attributes_to_log.merge!(scout_layer)
|
@@ -30,10 +33,6 @@ module ScoutApm
|
|
30
33
|
|
31
34
|
private
|
32
35
|
|
33
|
-
def attributes_to_log
|
34
|
-
@attributes_to_log ||= {}
|
35
|
-
end
|
36
|
-
|
37
36
|
def format_datetime(time)
|
38
37
|
time.utc.strftime(DATETIME_FORMAT)
|
39
38
|
end
|
@@ -48,6 +48,11 @@ describe ScoutApm::Logging do
|
|
48
48
|
expect(messages.count('[YIELD] Yield Test')).to eq(1)
|
49
49
|
expect(messages.count('Another Log')).to eq(1)
|
50
50
|
|
51
|
+
log_locations = lines.map { |item| item['log_location'] }.compact
|
52
|
+
|
53
|
+
# Verify that log attributes aren't persisted
|
54
|
+
expect(log_locations.size).to eq(1)
|
55
|
+
|
51
56
|
# Kill the rails process. We use kill as using any other signal throws a long log line.
|
52
57
|
Process.kill('KILL', rails_pid)
|
53
58
|
# Kill the process and ensure PID file clean up
|
data/spec/rails/app.rb
CHANGED
@@ -20,6 +20,7 @@ end
|
|
20
20
|
|
21
21
|
class RootController < ActionController::Base
|
22
22
|
def index
|
23
|
+
Rails.logger.warn('Add location log attributes')
|
23
24
|
Rails.logger.tagged('TEST').info('Some log')
|
24
25
|
Rails.logger.tagged('YIELD') { logger.info('Yield Test') }
|
25
26
|
Rails.logger.info('Another Log')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scout_apm_logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scout APM
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: scout_apm
|