birling 0.1.2 → 0.1.3
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 +7 -0
- data/Gemfile +1 -1
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/birling.gemspec +6 -5
- data/lib/birling/logger.rb +9 -2
- data/test/test_birling_logger.rb +10 -0
- metadata +12 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8a220611de2cd83e6b1a287c224613765b8ee134
|
4
|
+
data.tar.gz: 276014a8f6f9ab3d286ec16184379c459fa42dc2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3be82ad9a9bbeacfbde7cd6ce127992cc2270894bd8e7567cf8ecc39c5f8a3d1d966b52c9b19b2d79d6f03022422faa0c54c6f0e091e8903805b1fed2e3cd93f
|
7
|
+
data.tar.gz: 90ad6b767bccc672dd58365ef6c3592f725e737c6c0cbc0445b9968093fa16fba7f1ef8e3a8d8a0e1145a4e95760691571c213cdaffcd7c8403f59d6fe800839
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/birling.gemspec
CHANGED
@@ -2,14 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: birling 0.1.3 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "birling"
|
8
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.3"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["Scott Tadman"]
|
12
|
-
s.date = "
|
14
|
+
s.date = "2015-01-31"
|
13
15
|
s.description = "Mostly drop-in replacement for Logger with a more robust log rotation facility"
|
14
16
|
s.email = "github@tadman.ca"
|
15
17
|
s.extra_rdoc_files = [
|
@@ -35,12 +37,11 @@ Gem::Specification.new do |s|
|
|
35
37
|
]
|
36
38
|
s.homepage = "http://github.com/twg/birling"
|
37
39
|
s.licenses = ["MIT"]
|
38
|
-
s.
|
39
|
-
s.rubygems_version = "1.8.24"
|
40
|
+
s.rubygems_version = "2.2.2"
|
40
41
|
s.summary = "Logger with simple log rotation system"
|
41
42
|
|
42
43
|
if s.respond_to? :specification_version then
|
43
|
-
s.specification_version =
|
44
|
+
s.specification_version = 4
|
44
45
|
|
45
46
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
46
47
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
data/lib/birling/logger.rb
CHANGED
@@ -57,6 +57,7 @@ class Birling::Logger
|
|
57
57
|
# == Instance Methods =====================================================
|
58
58
|
|
59
59
|
def initialize(log, options = nil)
|
60
|
+
@encoding = (options and options[:encoding])
|
60
61
|
@period = (options and options[:period])
|
61
62
|
@severity = self.class.severity(options && options[:severity])
|
62
63
|
@retain_count = (options and options[:retain_count])
|
@@ -66,6 +67,12 @@ class Birling::Logger
|
|
66
67
|
@time_source = (options and options[:time_source] or Time)
|
67
68
|
@path_format = (options and options[:path_format])
|
68
69
|
|
70
|
+
@file_open_options = { }
|
71
|
+
|
72
|
+
if (@encoding)
|
73
|
+
@file_open_options[:encoding] = @encoding
|
74
|
+
end
|
75
|
+
|
69
76
|
case (log)
|
70
77
|
when IO, StringIO
|
71
78
|
@log = log
|
@@ -240,7 +247,7 @@ protected
|
|
240
247
|
if (@path_format)
|
241
248
|
@current_path = @time_source.now.strftime(@path_format)
|
242
249
|
|
243
|
-
@log = File.open(@current_path, 'a')
|
250
|
+
@log = File.open(@current_path, 'a', @file_open_options)
|
244
251
|
@log.sync = true
|
245
252
|
|
246
253
|
if (File.exist?(@path) and File.symlink?(@path))
|
@@ -255,7 +262,7 @@ protected
|
|
255
262
|
else
|
256
263
|
@current_path = @path
|
257
264
|
|
258
|
-
@log = File.open(@current_path, 'a')
|
265
|
+
@log = File.open(@current_path, 'a', @file_open_options)
|
259
266
|
end
|
260
267
|
end
|
261
268
|
end
|
data/test/test_birling_logger.rb
CHANGED
@@ -219,4 +219,14 @@ class TestBirlingLogger < Test::Unit::TestCase
|
|
219
219
|
assert_equal retain_period + 1, Dir.glob(logger.path_format % '*').length
|
220
220
|
end
|
221
221
|
end
|
222
|
+
|
223
|
+
def test_irregular_utf8_data
|
224
|
+
temp_path(:cycle) do |path|
|
225
|
+
logger = Birling::Logger.new(path, encoding: 'BINARY')
|
226
|
+
|
227
|
+
invalid = (0..255).to_a.pack('C*')
|
228
|
+
|
229
|
+
logger.debug(invalid)
|
230
|
+
end
|
231
|
+
end
|
222
232
|
end
|
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: birling
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Scott Tadman
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: jeweler
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
description: Mostly drop-in replacement for Logger with a more robust log rotation
|
@@ -52,7 +47,7 @@ extra_rdoc_files:
|
|
52
47
|
- LICENSE.txt
|
53
48
|
- README.md
|
54
49
|
files:
|
55
|
-
- .document
|
50
|
+
- ".document"
|
56
51
|
- Gemfile
|
57
52
|
- LICENSE.txt
|
58
53
|
- README.md
|
@@ -70,26 +65,25 @@ files:
|
|
70
65
|
homepage: http://github.com/twg/birling
|
71
66
|
licenses:
|
72
67
|
- MIT
|
68
|
+
metadata: {}
|
73
69
|
post_install_message:
|
74
70
|
rdoc_options: []
|
75
71
|
require_paths:
|
76
72
|
- lib
|
77
73
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
74
|
requirements:
|
80
|
-
- -
|
75
|
+
- - ">="
|
81
76
|
- !ruby/object:Gem::Version
|
82
77
|
version: '0'
|
83
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
79
|
requirements:
|
86
|
-
- -
|
80
|
+
- - ">="
|
87
81
|
- !ruby/object:Gem::Version
|
88
82
|
version: '0'
|
89
83
|
requirements: []
|
90
84
|
rubyforge_project:
|
91
|
-
rubygems_version:
|
85
|
+
rubygems_version: 2.2.2
|
92
86
|
signing_key:
|
93
|
-
specification_version:
|
87
|
+
specification_version: 4
|
94
88
|
summary: Logger with simple log rotation system
|
95
89
|
test_files: []
|