appsignal 0.7.0.alpha.1 → 0.7.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +1 -0
- data/lib/appsignal.rb +9 -2
- data/lib/appsignal/integrations/rails.rb +2 -10
- data/lib/appsignal/integrations/sinatra.rb +1 -4
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/cli_spec.rb +3 -5
- data/spec/lib/appsignal_spec.rb +45 -0
- data/spec/spec_helper.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWZmZGFhYzgyNmJhNzg3Y2Y5MGY3ODdmNzgzOGZhOGY1ZmNjOTY1NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGJmNDhlYzA5MDc3Njg2NjczMDdhNGY2MGQ4YzA3NTE5MGRkMzA1YQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2Y0NDM0OThjYTA5MDkwMDYxYzBmNDg0NjU4NzRkMDZjNTBhNTAwNWU0ZTQ4
|
10
|
+
ZTY1ZDFjZGYzMWQ0MjI4ZDEyZWE1OGI0NjY1NmEyYzdmYmM1NWE0Mjc4YmNm
|
11
|
+
MmM1NThkMDI0N2MxMDlhYzc2MzVlNTY2NzUyZTQwYzBmMDhkMGY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTNkOTQ2ZjEyOWRjZDljYTMyNGQ5YTcxZWIzZTJmNjhkNTgzMjIxOTU5Zjgz
|
14
|
+
YzI5YTkxMDllZGZmMmQ4YzYzZWJmODViNjc3N2FiZjZhMzQ1NzI1YTljY2Mx
|
15
|
+
ZWVmMWZkYmU0MWMwMGM0MDkzMTNlMzcyNjYwMGU1NzI3NzI2NWQ=
|
data/CHANGELOG.md
CHANGED
data/lib/appsignal.rb
CHANGED
@@ -72,8 +72,15 @@ module Appsignal
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
def
|
76
|
-
|
75
|
+
def start_logger(path)
|
76
|
+
if path && File.writable?(path) && !ENV['DYNO']
|
77
|
+
@logger = Logger.new(File.join(path, 'appsignal.log'))
|
78
|
+
@logger.formatter = Logger::Formatter.new
|
79
|
+
else
|
80
|
+
@logger = Logger.new($stdout)
|
81
|
+
end
|
82
|
+
@logger.level = Logger::INFO
|
83
|
+
@logger << @in_memory_log.string
|
77
84
|
end
|
78
85
|
|
79
86
|
def json
|
@@ -10,16 +10,8 @@ if defined?(::Rails)
|
|
10
10
|
end
|
11
11
|
|
12
12
|
config.after_initialize do
|
13
|
-
#
|
14
|
-
|
15
|
-
output = Rails.root.join('log/appsignal.log')
|
16
|
-
else
|
17
|
-
output = STDOUT
|
18
|
-
end
|
19
|
-
Appsignal.logger = Logger.new(output).tap do |l|
|
20
|
-
l.level = Logger::INFO
|
21
|
-
end
|
22
|
-
Appsignal.flush_in_memory_log
|
13
|
+
# Start logger
|
14
|
+
Appsignal.start_logger(Rails.root.join('log'))
|
23
15
|
|
24
16
|
# Load config
|
25
17
|
Appsignal.config = Appsignal::Config.new(Rails.root, Rails.env)
|
@@ -8,10 +8,7 @@ Appsignal.config = Appsignal::Config.new(
|
|
8
8
|
app_settings.environment.to_s
|
9
9
|
)
|
10
10
|
|
11
|
-
Appsignal.
|
12
|
-
l.level = Logger::DEBUG
|
13
|
-
end
|
14
|
-
Appsignal.flush_in_memory_log
|
11
|
+
Appsignal.start_logger(app_settings.root)
|
15
12
|
|
16
13
|
if Appsignal.active?
|
17
14
|
Appsignal.start
|
data/lib/appsignal/version.rb
CHANGED
@@ -3,18 +3,16 @@ require 'appsignal/cli'
|
|
3
3
|
|
4
4
|
describe Appsignal::CLI do
|
5
5
|
let(:out_stream) { StringIO.new }
|
6
|
-
let(:error_stream) { StringIO.new }
|
7
6
|
let(:cli) { Appsignal::CLI }
|
8
7
|
before do
|
9
|
-
@original_stdout
|
10
|
-
$stdout
|
8
|
+
@original_stdout = $stdout
|
9
|
+
$stdout = out_stream
|
11
10
|
ENV['PWD'] = project_fixture_path
|
12
11
|
cli.config = nil
|
13
12
|
cli.options = {:environment => 'production'}
|
14
13
|
end
|
15
|
-
after
|
14
|
+
after do
|
16
15
|
$stdout = @original_stdout
|
17
|
-
$stderr = @original_stderr
|
18
16
|
end
|
19
17
|
|
20
18
|
describe "#logger" do
|
data/spec/lib/appsignal_spec.rb
CHANGED
@@ -122,6 +122,51 @@ describe Appsignal do
|
|
122
122
|
it { should be_a Logger }
|
123
123
|
end
|
124
124
|
|
125
|
+
describe ".start_logger" do
|
126
|
+
let(:out_stream) { StringIO.new }
|
127
|
+
let(:log_file) { File.join(path, 'appsignal.log') }
|
128
|
+
before do
|
129
|
+
@original_stdout = $stdout
|
130
|
+
$stdout = out_stream
|
131
|
+
Appsignal.logger.error('Log something')
|
132
|
+
end
|
133
|
+
after do
|
134
|
+
$stdout = @original_stdout
|
135
|
+
end
|
136
|
+
|
137
|
+
context "when the log path is writable" do
|
138
|
+
let(:path) { File.join(project_fixture_path, 'log') }
|
139
|
+
before { Appsignal.start_logger(path) }
|
140
|
+
|
141
|
+
it "should log to file" do
|
142
|
+
File.exists?(log_file).should be_true
|
143
|
+
File.open(log_file).read.should include 'Log something'
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
context "when the log path is not writable" do
|
148
|
+
let(:path) { '/nonsense/log' }
|
149
|
+
before { Appsignal.start_logger(path) }
|
150
|
+
|
151
|
+
it "should log to stdout" do
|
152
|
+
out_stream.string.should include 'Log something'
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
context "when we're on Heroku" do
|
157
|
+
let(:path) { File.join(project_fixture_path, 'log') }
|
158
|
+
before do
|
159
|
+
ENV['DYNO'] = 'dyno1'
|
160
|
+
Appsignal.start_logger(path)
|
161
|
+
end
|
162
|
+
after { ENV.delete('DYNO') }
|
163
|
+
|
164
|
+
it "should log to stdout" do
|
165
|
+
out_stream.string.should include 'Log something'
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
125
170
|
describe '.config' do
|
126
171
|
subject { Appsignal.config }
|
127
172
|
|
data/spec/spec_helper.rb
CHANGED
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: 0.7.0.alpha.
|
4
|
+
version: 0.7.0.alpha.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-11-
|
15
|
+
date: 2013-11-13 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activesupport
|