simple_rotate 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simple_rotate/const.rb +1 -1
- data/lib/simple_rotate/internal/process_sync.rb +6 -7
- data/lib/simple_rotate/private.rb +11 -6
- 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: be22a3c38d7b281549b2f6f2b782793ba8a6a3ab
|
4
|
+
data.tar.gz: d19711617196e08109a09c536010ce4296cd886f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcb0a5ad487e2f07c82cf6225155958922d3afde9f2cb9fec950c427482843477a1d149c72fe096227d25bda0b56d8d60dae2c7ce91903629d5d759abef1fb38
|
7
|
+
data.tar.gz: c962cdad590764c25af7f8bbee41beb655b8cae1069890474133e6be1c32a44d9837e1b61466abced8b7a6562f091aa69eb5d7d2680e089af520c3503cda18f3
|
data/lib/simple_rotate/const.rb
CHANGED
@@ -16,16 +16,15 @@ class SimpleRotate
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def initialize(sr)
|
19
|
-
@sr
|
20
|
-
@enable
|
21
|
-
|
19
|
+
@sr = sr
|
20
|
+
@enable = sr.instance_variable_defined?(:@is_psync) ? sr.instance_variable_get(:@is_psync) : nil
|
21
|
+
file_name = sr.instance_variable_defined?(:@file_name) ? sr.instance_variable_get(:@file_name) : nil
|
22
22
|
|
23
23
|
# #init not called
|
24
|
-
return self if
|
24
|
+
return self if file_name == nil
|
25
25
|
|
26
|
-
@logf = sr.instance_variable_get(:@logf)
|
27
26
|
@try_limit = 3
|
28
|
-
@@tempf_name = File.dirname(
|
27
|
+
@@tempf_name = File.dirname(file_name) + File::SEPARATOR + ".SimpleRotate_tempfile_#{File.basename($0)}"
|
29
28
|
|
30
29
|
create_tempfile if @enable && !@@scheduled_del_lockfile
|
31
30
|
end
|
@@ -59,7 +58,7 @@ class SimpleRotate
|
|
59
58
|
def set_delete_tempfile
|
60
59
|
return true if @@scheduled_del_lockfile
|
61
60
|
|
62
|
-
if File.
|
61
|
+
if File.exist?(@@tempf_name)
|
63
62
|
# is it empty?
|
64
63
|
if File.size(@@tempf_name) == 0
|
65
64
|
delete_at_end
|
@@ -45,11 +45,11 @@ class SimpleRotate
|
|
45
45
|
@logf.puts("created@#{gtime}@Please don't delete this line")
|
46
46
|
@logf.close
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
rescue
|
49
|
+
SimpleRotate::Error.open(@file_name)
|
50
|
+
end
|
51
51
|
|
52
|
-
|
52
|
+
openadd
|
53
53
|
end
|
54
54
|
|
55
55
|
# if file or directory exist, call error
|
@@ -82,7 +82,7 @@ class SimpleRotate
|
|
82
82
|
que << [%{@sleep_time}, %{0}]
|
83
83
|
|
84
84
|
que.each do |q|
|
85
|
-
if eval(%{
|
85
|
+
if !eval(%{self.instance_variable_defined? :#{q[0]}})
|
86
86
|
eval(%{#{q[0]} = #{q[1]}})
|
87
87
|
end
|
88
88
|
end
|
@@ -213,7 +213,12 @@ class SimpleRotate
|
|
213
213
|
# @return string
|
214
214
|
private
|
215
215
|
def get_trimmed_log(log)
|
216
|
-
log
|
216
|
+
if log == nil
|
217
|
+
log = log.inspect
|
218
|
+
else
|
219
|
+
log = log.to_s
|
220
|
+
end
|
221
|
+
|
217
222
|
date = Time.now.strftime(@date_format)
|
218
223
|
level = eval("LOG_LEVEL_#{@log_level}")
|
219
224
|
return @logging_format.gsub("$DATE", date)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_rotate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- khotta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Simple and safety logger. http://khotta.github.io/
|
14
14
|
email:
|