teelogger 0.4.0 → 0.4.1
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 +4 -4
- data/.travis.yml +2 -0
- data/Gemfile +2 -0
- data/README.md +19 -0
- data/features/logger.feature +17 -0
- data/features/step_definitions/steps.rb +22 -4
- data/features/support/env.rb +3 -0
- data/lib/teelogger/version.rb +1 -1
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a05f90f38dfc709f361c48700fd75abc7b4cae97
|
4
|
+
data.tar.gz: 21adf664c10e60ff5788c4b1b6b782cda65158ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4088feb8ab68f3635e0ae30d88bbefc2ec498c0f6fb3c05b20158b73eeb47ca1253c5c1ba2fe69668f3fcce4dcb103c4b0e96036c0d77e63b91060dccc693605
|
7
|
+
data.tar.gz: edcccbf758d9b8cc6b95ae5694ab60869c565062447ccef2fa1b78916a1d67e16e411082f4639135f355c22276fd15e82e4d2563d3c0433b8614c0ba81088a79
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,8 @@ Mini wrapper around Ruby Logger for logging to multiple destinations.
|
|
4
4
|
|
5
5
|
[](http://badge.fury.io/rb/teelogger)
|
6
6
|
[](https://travis-ci.org/spriteCloud/teelogger)
|
7
|
+
[](https://codeclimate.com/github/spriteCloud/teelogger)
|
8
|
+
[](https://codeclimate.com/github/spriteCloud/teelogger)
|
7
9
|
|
8
10
|
## Installation
|
9
11
|
|
@@ -49,6 +51,23 @@ log.each do |name, logger|
|
|
49
51
|
end
|
50
52
|
```
|
51
53
|
|
54
|
+
Unlike the standard Ruby logger, flushing log contents is more deterministic.
|
55
|
+
`TeeLogger#flush` flushes not only the Ruby buffers of all loggers, but also
|
56
|
+
tries to invoke [IO#fsync](http://ruby-doc.org/core-2.2.1/IO.html#method-i-fsync).
|
57
|
+
In addition, `TeeLogger` lets you set a flush interval indicating after how
|
58
|
+
many messages logged `TeeLogger#flush` is to be invoked automatically:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
require 'teelogger'
|
62
|
+
|
63
|
+
log = TeeLogger::TeeLogger.new(STDOUT, "filename.log")
|
64
|
+
log.flush_interval = 1 # flush every line
|
65
|
+
log["filename.log"].flush_interval = 2 # flush every other line
|
66
|
+
|
67
|
+
log.info "first message" # flushes STDOUT
|
68
|
+
log.info "second message" # flushes STDOUT and filename.log
|
69
|
+
```
|
70
|
+
|
52
71
|
## Contributing
|
53
72
|
|
54
73
|
1. Fork it ( https://github.com/[my-github-username]/teelogger/fork )
|
data/features/logger.feature
CHANGED
@@ -73,3 +73,20 @@ Feature: Logger
|
|
73
73
|
| ERROR |
|
74
74
|
| FATAL |
|
75
75
|
|
76
|
+
@logger_06
|
77
|
+
Scenario Outline: Exception logging
|
78
|
+
Given I create a TeeLogger with an IO object
|
79
|
+
And I set the log level to "<level>"
|
80
|
+
And I log an exception
|
81
|
+
Then I expect the log level "<level>" to have taken hold
|
82
|
+
And I expect the log message to <appear> in the IO object
|
83
|
+
|
84
|
+
Examples:
|
85
|
+
| level | appear |
|
86
|
+
| DEBUG | appear |
|
87
|
+
| INFO | appear |
|
88
|
+
| WARN | appear |
|
89
|
+
| ERROR | appear |
|
90
|
+
| FATAL | not appear |
|
91
|
+
|
92
|
+
|
@@ -52,10 +52,6 @@ Given(/^I create a TeeLogger with an IO object$/) do
|
|
52
52
|
logger = TeeLogger::TeeLogger.new io
|
53
53
|
end
|
54
54
|
|
55
|
-
Then(/^I expect the log message to appear in the IO object$/) do
|
56
|
-
assert io.string.include?(message), "Test message '#{message}' not included in output."
|
57
|
-
end
|
58
|
-
|
59
55
|
Given(/^I create a TeeLogger with multiple loggers$/) do
|
60
56
|
args = []
|
61
57
|
3.times do
|
@@ -71,3 +67,25 @@ Then(/^I expect the class to let me access all loggers like a hash$/) do
|
|
71
67
|
end
|
72
68
|
end
|
73
69
|
|
70
|
+
|
71
|
+
Given(/^I log an exception$/) do
|
72
|
+
begin
|
73
|
+
raise "Some error"
|
74
|
+
rescue StandardError => err
|
75
|
+
message = "@@EXCEPTION@@"
|
76
|
+
logger.exception(message, err)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
Then(/^I expect the log message to (.*?) in the IO object$/) do |appear|
|
81
|
+
appear.strip!
|
82
|
+
case appear
|
83
|
+
when "appear"
|
84
|
+
assert io.string.include?(message), "Test message '#{message}' not included in output."
|
85
|
+
when "not appear"
|
86
|
+
assert !io.string.include?(message), "Test message '#{message}' included in output, didn't expect that!"
|
87
|
+
else
|
88
|
+
raise "Not implemented: appear == '#{appear}'"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
data/features/support/env.rb
CHANGED
data/lib/teelogger/version.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teelogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Finkhaeuser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cucumber
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: Mini wrapper around Ruby Logger for logging to multiple destinations.
|
@@ -73,8 +73,8 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
-
|
77
|
-
-
|
76
|
+
- .gitignore
|
77
|
+
- .travis.yml
|
78
78
|
- Gemfile
|
79
79
|
- LICENSE
|
80
80
|
- README.md
|
@@ -95,12 +95,12 @@ require_paths:
|
|
95
95
|
- lib
|
96
96
|
required_ruby_version: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
|
-
- -
|
98
|
+
- - '>='
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- -
|
103
|
+
- - '>='
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
requirements: []
|