woolen_common 0.0.11 → 0.0.12
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/lib/woolen_common/logger.rb +16 -12
- data/lib/woolen_common/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 041e69562b002c4b6797f10b5739b3cfba53ec17
|
4
|
+
data.tar.gz: cfa1b51cf3365b2823e0b0119a11e812d8e2b47d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ba57396a19c91fb3df38477723ea5dd66eee1444a67ad14df5bd937891494a54dbf41f8ba7059dce87679059a1db39c2a3c9d69ec9126c8cfea37f53063ef74
|
7
|
+
data.tar.gz: 51f3b745df5cb22d74f9501cbf6cdf1e4458c58e1e1eadbe812bcdb9a19427a082f1f01d5cadb066af8a6a24f526993cd3a30b94fe970f02c375e2967ca15ab8
|
data/lib/woolen_common/logger.rb
CHANGED
@@ -146,13 +146,13 @@ module WoolenCommon
|
|
146
146
|
def rename_and_create_new(newfilename)
|
147
147
|
# fix Error::EACCESS exception throw when file is opened before rename by lyf
|
148
148
|
begin
|
149
|
-
@file.flush
|
150
|
-
@file.close
|
149
|
+
@file.flush rescue nil
|
150
|
+
@file.close rescue nil
|
151
151
|
FileUtils.cp(@file.path, newfilename)
|
152
|
-
clean_log @file.path
|
152
|
+
clean_log @file.path rescue nil
|
153
153
|
@file.reopen(@file.path, "w")
|
154
154
|
rescue Exception => e
|
155
|
-
puts "error when try to rename_and_create_new #{newfilename}"
|
155
|
+
puts "error when try to rename_and_create_new #{newfilename},#{e.message}"
|
156
156
|
end
|
157
157
|
#unless (FileUtils.cp(@file.path, newfilename) and FileUtils.rm_f(@file.path) and @file.reopen(@file.path, "w"))
|
158
158
|
# #puts "==> error rename #{@filename} => #{newfilename}"
|
@@ -175,10 +175,10 @@ module WoolenCommon
|
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
|
-
def check_split_file
|
178
|
+
def check_split_file(force=false)
|
179
179
|
begin
|
180
|
-
if @roll_type ==
|
181
|
-
if @last_log_time && @last_log_time.day != Time.now.day
|
180
|
+
if @roll_type == 'daily'
|
181
|
+
if force or (@last_log_time && @last_log_time.day != Time.now.day)
|
182
182
|
p = @file.path
|
183
183
|
new_name = nil
|
184
184
|
if p.rindex(".") > p.rindex("/")
|
@@ -188,8 +188,8 @@ module WoolenCommon
|
|
188
188
|
end
|
189
189
|
rename_and_create_new(new_name)
|
190
190
|
end
|
191
|
-
elsif @roll_type ==
|
192
|
-
if File.size(@file) >= @roll_param
|
191
|
+
elsif @roll_type == 'file_size'
|
192
|
+
if force or ( File.size(@file) >= @roll_param )
|
193
193
|
p = @file.path
|
194
194
|
new_name = nil
|
195
195
|
if p.rindex(".") > p.rindex("/")
|
@@ -244,9 +244,13 @@ module WoolenCommon
|
|
244
244
|
file_need_to_pus_cache << value
|
245
245
|
#@file.dup if @file
|
246
246
|
end
|
247
|
-
|
248
|
-
@file
|
249
|
-
|
247
|
+
begin
|
248
|
+
if @file
|
249
|
+
@file.print file_need_to_pus_cache
|
250
|
+
@file.flush
|
251
|
+
end
|
252
|
+
rescue Exception => es
|
253
|
+
check_split_file true
|
250
254
|
end
|
251
255
|
end
|
252
256
|
@last_log_time = Time.now
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: woolen_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- just_woolen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|