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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e088e9bf45178e23ef873d64e92e168bc026f41
4
- data.tar.gz: 8fcc295b88f5edac15e16f1af825aa2b9d9e64db
3
+ metadata.gz: 319032cdafb0eafdaf8988a638704e5b9a34dfeb
4
+ data.tar.gz: d5583282916fa7104affcea80620c993f5ba0deb
5
5
  SHA512:
6
- metadata.gz: d3af87c076d10eae81b2a574204c516280fc1b35020c3123a0e9846c2d9e88c928fa8f460c9d872a2f2684aedd339a5c5f81de3a9ef85b68439dea32f6c816e7
7
- data.tar.gz: ad7dcd2fd514cc53ef23947477ed67a020112e130326d893642fdfdbd65e41df6e9b8ac0c96f030534fcebb08f82f5a53faae804519e446d24b3fdcf9ce58902
6
+ metadata.gz: 807e591c9ea27e1c046e761ab61214112246a99a98e9bf9ad9567d917fadc244c89cda1acd6c40506d1a3d224368fe3dbe9886b26fba0566e2e4422de509cce1
7
+ data.tar.gz: c2f93bd2d7946e787c0f3a815b67151c7473ba20f16704b0b0869d023cb5e0ddd5591eab7d5040ec87676adda1b3dfdda443e8d12fbc78261dc70031af6310f1
data/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## 1.1.0 (2015-08-17)
4
+
5
+ * Enhancements
6
+ * strftime format for directory name
7
+
8
+ ```ruby
9
+ logger = ChronoLogger.new('%Y/%m/%d.log')
10
+ ```
11
+
12
+ ## 1.0.0 (2015-02-05)
13
+
14
+ * First Major Release
15
+
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
@@ -1,5 +1,5 @@
1
1
  require 'logger'
2
2
 
3
3
  class ChronoLogger < Logger
4
- VERSION = "1.0.0"
4
+ VERSION = "1.1.0"
5
5
  end
@@ -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.0.0
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-02-05 00:00:00.000000000 Z
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.4.5
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.