chrono_logger 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +4 -0
- data/lib/chrono_logger.rb +2 -0
- data/lib/chrono_logger/version.rb +1 -1
- data/test/test_chrono_logger.rb +17 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 319032cdafb0eafdaf8988a638704e5b9a34dfeb
|
4
|
+
data.tar.gz: d5583282916fa7104affcea80620c993f5ba0deb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 807e591c9ea27e1c046e761ab61214112246a99a98e9bf9ad9567d917fadc244c89cda1acd6c40506d1a3d224368fe3dbe9886b26fba0566e2e4422de509cce1
|
7
|
+
data.tar.gz: c2f93bd2d7946e787c0f3a815b67151c7473ba20f16704b0b0869d023cb5e0ddd5591eab7d5040ec87676adda1b3dfdda443e8d12fbc78261dc70031af6310f1
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -108,3 +108,7 @@ MIT. See [LICENSE.txt](LICENSE.txt) for more details.
|
|
108
108
|
|
109
109
|
- [ChronoLogger logging is 1.5x faster than ruby's stdlib Logger](https://coderwall.com/p/vjjszq/chronologger-logging-is-1-5x-faster-than-ruby-s-stdlib-logger)
|
110
110
|
|
111
|
+
|
112
|
+
|
113
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ma2gedev/chrono_logger/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
114
|
+
|
data/lib/chrono_logger.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "chrono_logger/version"
|
2
2
|
require 'logger'
|
3
|
+
require 'pathname'
|
3
4
|
|
4
5
|
# A lock-free logger with timebased file rotation.
|
5
6
|
class ChronoLogger < Logger
|
@@ -91,6 +92,7 @@ class ChronoLogger < Logger
|
|
91
92
|
|
92
93
|
def create_logfile(filename)
|
93
94
|
begin
|
95
|
+
Pathname(filename).dirname.mkpath
|
94
96
|
logdev = open(filename, (File::WRONLY | File::APPEND | File::CREAT | File::EXCL))
|
95
97
|
logdev.sync = true
|
96
98
|
rescue Errno::EEXIST
|
data/test/test_chrono_logger.rb
CHANGED
@@ -46,6 +46,23 @@ class TestChronoLogger < Test::Unit::TestCase
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
def test_rotation_per_day_and_create_dir
|
50
|
+
Dir.mktmpdir do |tmpdir|
|
51
|
+
begin
|
52
|
+
Delorean.time_travel_to '2015-08-01 23:59:50'
|
53
|
+
logger = ChronoLogger.new([tmpdir, '/%Y/%m/%d/test.log'].join)
|
54
|
+
logger.debug 'rotation'
|
55
|
+
Delorean.time_travel_to '2015-08-02 00:00:01'
|
56
|
+
logger.debug 'new dir'
|
57
|
+
|
58
|
+
assert { File.exist?([tmpdir, '/2015/08/01/test.log'].join) }
|
59
|
+
assert { File.exist?([tmpdir, '/2015/08/02/test.log'].join) }
|
60
|
+
ensure
|
61
|
+
Delorean.back_to_the_present
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
49
66
|
class PeriodTest
|
50
67
|
include ChronoLogger::Period
|
51
68
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chrono_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takayuki Matsubara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -145,6 +145,7 @@ extra_rdoc_files: []
|
|
145
145
|
files:
|
146
146
|
- ".gitignore"
|
147
147
|
- ".travis.yml"
|
148
|
+
- CHANGELOG.md
|
148
149
|
- Gemfile
|
149
150
|
- LICENSE.txt
|
150
151
|
- README.md
|
@@ -177,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
178
|
version: '0'
|
178
179
|
requirements: []
|
179
180
|
rubyforge_project:
|
180
|
-
rubygems_version: 2.
|
181
|
+
rubygems_version: 2.2.2
|
181
182
|
signing_key:
|
182
183
|
specification_version: 4
|
183
184
|
summary: A lock-free logger with timebased file rotation.
|