lumberjack_aziz_light 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/lumberjack/device/date_rolling_log_file.rb +14 -9
- data/lib/lumberjack/device/size_rolling_log_file.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c13f582284b6e863efb7cb121e413c1aa064da6
|
4
|
+
data.tar.gz: d3d424b0f33b547dd28362374dc6befde889682c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29e68560a8743a2b915fa7820b24c92a505ccbaf9666dbaebde01501e753b10ead2b3f6d347ae17ea5e8d814316611e5db093dab9c2c04f28c2e41b542de9c4e
|
7
|
+
data.tar.gz: 8235405c7cbfb5b0a112d3a4c055f9e0a20184d55dad9d12ff41f278711e685569a97899b818acf4f996173f9773a645c479cc5296365754c14a03ae4f15afed
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
@@ -12,6 +12,7 @@ module Lumberjack
|
|
12
12
|
# with the <tt>:roll</tt> option which may contain a value of <tt>:daily</tt>, <tt>:weekly</tt>,
|
13
13
|
# or <tt>:monthly</tt>.
|
14
14
|
def initialize(path, options = {})
|
15
|
+
@manual = options[:manual]
|
15
16
|
@file_date = Date.today
|
16
17
|
if options[:roll] && options[:roll].to_s.match(/(daily)|(weekly)|(monthly)/i)
|
17
18
|
@roll_period = $~[0].downcase.to_sym
|
@@ -34,17 +35,21 @@ module Lumberjack
|
|
34
35
|
end
|
35
36
|
|
36
37
|
def roll_file?
|
37
|
-
|
38
|
-
if date.year > @file_date.year
|
39
|
-
true
|
40
|
-
elsif @roll_period == :daily && date.yday > @file_date.yday
|
41
|
-
true
|
42
|
-
elsif @roll_period == :weekly && date.cweek > @file_date.cweek
|
43
|
-
true
|
44
|
-
elsif @roll_period == :monthly && date.month > @file_date.month
|
38
|
+
if @manual
|
45
39
|
true
|
46
40
|
else
|
47
|
-
|
41
|
+
date = Date.today
|
42
|
+
if date.year > @file_date.year
|
43
|
+
true
|
44
|
+
elsif @roll_period == :daily && date.yday > @file_date.yday
|
45
|
+
true
|
46
|
+
elsif @roll_period == :weekly && date.cweek > @file_date.cweek
|
47
|
+
true
|
48
|
+
elsif @roll_period == :monthly && date.month > @file_date.month
|
49
|
+
true
|
50
|
+
else
|
51
|
+
false
|
52
|
+
end
|
48
53
|
end
|
49
54
|
end
|
50
55
|
|
@@ -10,6 +10,7 @@ module Lumberjack
|
|
10
10
|
# Create an new log device to the specified file. The maximum size of the log file is specified with
|
11
11
|
# the <tt>:max_size</tt> option. The unit can also be specified: "32K", "100M", "2G" are all valid.
|
12
12
|
def initialize(path, options = {})
|
13
|
+
@manual = options[:manual]
|
13
14
|
@max_size = options[:max_size]
|
14
15
|
if @max_size.is_a?(String)
|
15
16
|
if @max_size.match(/^(\d+(\.\d+)?)([KMG])?$/i)
|
@@ -37,7 +38,7 @@ module Lumberjack
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def roll_file?
|
40
|
-
stream.stat.size > @max_size
|
41
|
+
@manual || stream.stat.size > @max_size
|
41
42
|
rescue SystemCallError => e
|
42
43
|
false
|
43
44
|
end
|