appsignal 3.3.5 → 3.3.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,23 +1,22 @@
1
1
  describe Appsignal::Logger do
2
- let(:level) { ::Logger::DEBUG }
3
- let(:logger) { Appsignal::Logger.new("group", level) }
2
+ let(:logger) { Appsignal::Logger.new("group", :level => ::Logger::DEBUG) }
4
3
 
5
4
  it "should not create a logger with a nil group" do
6
5
  expect do
7
- Appsignal::Logger.new(nil, level)
6
+ Appsignal::Logger.new(nil)
8
7
  end.to raise_error(TypeError)
9
8
  end
10
9
 
11
10
  describe "#add" do
12
11
  it "should log with a level and message" do
13
12
  expect(Appsignal::Extension).to receive(:log)
14
- .with("group", 3, "Log message", instance_of(Appsignal::Extension::Data))
13
+ .with("group", 3, 0, "Log message", instance_of(Appsignal::Extension::Data))
15
14
  logger.add(::Logger::INFO, "Log message")
16
15
  end
17
16
 
18
17
  it "should log with a block" do
19
18
  expect(Appsignal::Extension).to receive(:log)
20
- .with("group", 3, "Log message", instance_of(Appsignal::Extension::Data))
19
+ .with("group", 3, 0, "Log message", instance_of(Appsignal::Extension::Data))
21
20
  logger.add(::Logger::INFO) do
22
21
  "Log message"
23
22
  end
@@ -25,7 +24,7 @@ describe Appsignal::Logger do
25
24
 
26
25
  it "should log with a level, message and group" do
27
26
  expect(Appsignal::Extension).to receive(:log)
28
- .with("other_group", 3, "Log message", instance_of(Appsignal::Extension::Data))
27
+ .with("other_group", 3, 0, "Log message", instance_of(Appsignal::Extension::Data))
29
28
  logger.add(::Logger::INFO, "Log message", "other_group")
30
29
  end
31
30
 
@@ -34,8 +33,8 @@ describe Appsignal::Logger do
34
33
  logger.add(::Logger::INFO, nil)
35
34
  end
36
35
 
37
- context "with debug log level" do
38
- let(:level) { ::Logger::INFO }
36
+ context "with info log level" do
37
+ let(:logger) { Appsignal::Logger.new("group", :level => ::Logger::INFO) }
39
38
 
40
39
  it "should skip logging if the level is too low" do
41
40
  expect(Appsignal::Extension).not_to receive(:log)
@@ -43,6 +42,16 @@ describe Appsignal::Logger do
43
42
  end
44
43
  end
45
44
 
45
+ context "with a format set" do
46
+ let(:logger) { Appsignal::Logger.new("group", :format => Appsignal::Logger::LOGFMT) }
47
+
48
+ it "should log and pass the format flag" do
49
+ expect(Appsignal::Extension).to receive(:log)
50
+ .with("group", 3, 1, "Log message", instance_of(Appsignal::Extension::Data))
51
+ logger.add(::Logger::INFO, "Log message")
52
+ end
53
+ end
54
+
46
55
  context "with a formatter set" do
47
56
  before do
48
57
  logger.formatter = proc do |_level, _timestamp, _appname, message|
@@ -52,7 +61,7 @@ describe Appsignal::Logger do
52
61
 
53
62
  it "should log with a level, message and group" do
54
63
  expect(Appsignal::Extension).to receive(:log)
55
- .with("other_group", 3, "formatted: 'Log message'", instance_of(Appsignal::Extension::Data))
64
+ .with("other_group", 3, 0, "formatted: 'Log message'", instance_of(Appsignal::Extension::Data))
56
65
  logger.add(::Logger::INFO, "Log message", "other_group")
57
66
  end
58
67
  end
@@ -71,7 +80,7 @@ describe Appsignal::Logger do
71
80
  .with({})
72
81
  .and_call_original
73
82
  expect(Appsignal::Extension).to receive(:log)
74
- .with("group", method[1], "Log message", instance_of(Appsignal::Extension::Data))
83
+ .with("group", method[1], 0, "Log message", instance_of(Appsignal::Extension::Data))
75
84
 
76
85
  logger.send(method[0], "Log message")
77
86
  end
@@ -81,7 +90,7 @@ describe Appsignal::Logger do
81
90
  .with({})
82
91
  .and_call_original
83
92
  expect(Appsignal::Extension).to receive(:log)
84
- .with("group", method[1], "Log message", instance_of(Appsignal::Extension::Data))
93
+ .with("group", method[1], 0, "Log message", instance_of(Appsignal::Extension::Data))
85
94
 
86
95
  logger.send(method[0]) do
87
96
  "Log message"
@@ -95,7 +104,7 @@ describe Appsignal::Logger do
95
104
 
96
105
  if method[2]
97
106
  context "with a lower log level" do
98
- let(:level) { method[2] }
107
+ let(:logger) { Appsignal::Logger.new("group", :level => method[2]) }
99
108
 
100
109
  it "should skip logging if the level is too low" do
101
110
  expect(Appsignal::Extension).not_to receive(:log)
@@ -113,7 +122,7 @@ describe Appsignal::Logger do
113
122
 
114
123
  it "should log with a level, message and group" do
115
124
  expect(Appsignal::Extension).to receive(:log)
116
- .with("group", method[1], "formatted: 'Log message'", instance_of(Appsignal::Extension::Data))
125
+ .with("group", method[1], 0, "formatted: 'Log message'", instance_of(Appsignal::Extension::Data))
117
126
  logger.send(method[0], "Log message")
118
127
  end
119
128
  end
@@ -52,3 +52,9 @@ old_config_mixed_with_new_config:
52
52
  "REQUEST_METHOD", "REQUEST_URI", "SERVER_NAME", "SERVER_PORT",
53
53
  "SERVER_PROTOCOL", "HTTP_USER_AGENT"
54
54
  ]
55
+
56
+ rack_env:
57
+ <<: *defaults
58
+
59
+ rails_env:
60
+ <<: *defaults
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.5
4
+ version: 3.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-02-13 00:00:00.000000000 Z
13
+ date: 2023-03-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
@@ -438,7 +438,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
438
438
  - !ruby/object:Gem::Version
439
439
  version: '0'
440
440
  requirements: []
441
- rubygems_version: 3.4.2
441
+ rubygems_version: 3.1.6
442
442
  signing_key:
443
443
  specification_version: 4
444
444
  summary: Logs performance and exception data from your app to appsignal.com