nice_http 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nice_http.rb +17 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 052b542a148c8c37dca6aa1a0811fd5fc5b3444f652622c9225201f8127c6560
|
4
|
+
data.tar.gz: a3f7b33c38d4e4950c87d1925980a7598f11d4777926bd66e0ff9be6f4f9bcd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d018a84c812d9667a7b9677e330155b579515bbc8fe70131203954b25be247aacf7f8fe30db0cf6ff9f2a46c2a7a4c7d77d7267df76c68c1ef24af77dd0d5c98
|
7
|
+
data.tar.gz: e11baceaedbfd53baf36b38df93352dec79fe2d2ea4d4cf151a6c799afdbfab720f1f7ece5e31539d8b2949fe4b8c5ebc703e227996c1aaef1177dfcb84c9ac4
|
data/lib/nice_http.rb
CHANGED
@@ -55,7 +55,7 @@ class NiceHttp
|
|
55
55
|
class << self
|
56
56
|
attr_accessor :host, :port, :ssl, :headers, :debug, :log, :proxy_host, :proxy_port,
|
57
57
|
:last_request, :last_response, :request_id, :use_mocks, :connections,
|
58
|
-
:active, :auto_redirect
|
58
|
+
:active, :auto_redirect, :log_files
|
59
59
|
end
|
60
60
|
|
61
61
|
######################################################
|
@@ -77,6 +77,7 @@ class NiceHttp
|
|
77
77
|
@connections = []
|
78
78
|
@active = 0
|
79
79
|
@auto_redirect = true
|
80
|
+
@log_files = []
|
80
81
|
end
|
81
82
|
reset!
|
82
83
|
|
@@ -193,22 +194,27 @@ class NiceHttp
|
|
193
194
|
end
|
194
195
|
|
195
196
|
begin
|
196
|
-
|
197
|
-
|
198
|
-
mode = "w"
|
199
|
-
else
|
200
|
-
mode = "a"
|
201
|
-
end
|
197
|
+
mode = "a"
|
198
|
+
log_filename =''
|
202
199
|
if @log.kind_of?(String)
|
203
|
-
|
200
|
+
#only the first connection in the run will be deleting the log file
|
201
|
+
log_filename = @log
|
202
|
+
mode = "w" unless self.class.log_files.include?(log_filename)
|
203
|
+
f = File.new(log_filename, mode)
|
204
204
|
f.sync = true
|
205
205
|
@logger = Logger.new f
|
206
206
|
elsif @log == :fix_file
|
207
|
-
|
207
|
+
#only the first connection in the run will be deleting the log file
|
208
|
+
log_filename = 'nice_http.log'
|
209
|
+
mode = "w" unless self.class.log_files.include?(log_filename)
|
210
|
+
f = File.new(log_filename, mode)
|
208
211
|
f.sync = true
|
209
212
|
@logger = Logger.new f
|
210
213
|
elsif @log == :file
|
211
|
-
|
214
|
+
log_filename = "nice_http_#{Time.now.strftime("%Y-%m-%d-%H%M%S")}.log"
|
215
|
+
#only the first connection in the run will be deleting the log file
|
216
|
+
mode = "w" unless self.class.log_files.include?(log_filename)
|
217
|
+
f = File.new(log_filename, mode)
|
212
218
|
f.sync = true
|
213
219
|
@logger = Logger.new f
|
214
220
|
elsif @log == :screen
|
@@ -219,6 +225,7 @@ class NiceHttp
|
|
219
225
|
raise InfoMissing, :log
|
220
226
|
end
|
221
227
|
@logger.level = Logger::INFO
|
228
|
+
self.class.log_files << log_filename if mode == 'w'
|
222
229
|
rescue Exception => stack
|
223
230
|
raise InfoMissing, :log
|
224
231
|
@logger = Logger.new nil
|