teelogger 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -3
- data/features/issues.feature +11 -0
- data/features/step_definitions/formatter_steps.rb +1 -1
- data/features/step_definitions/issue_steps.rb +36 -0
- data/features/support/env.rb +5 -4
- data/lib/teelogger.rb +0 -1
- data/lib/teelogger/filter.rb +4 -0
- data/lib/teelogger/filters/assignment.rb +1 -1
- data/lib/teelogger/filters/cli.rb +1 -1
- data/lib/teelogger/filters/recursive.rb +23 -16
- data/lib/teelogger/version.rb +1 -1
- data/teelogger.gemspec +2 -3
- metadata +21 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33bd79b4386cd699bb1293011cd5982edee2458d
|
4
|
+
data.tar.gz: 28df88866d33f0678d4ee964c68e8ffbd603d9c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e8ba78dcc4e630caa5c735f2a00552224289171af9bcf6db61aad02a7023a336db52279d040f608ccbca4edb150be736f4bbd4c5e20d7106bd30142ba813c26
|
7
|
+
data.tar.gz: 4f0b65a534c59edbc76a14d925c274d1733c5ce84ea88bd5415b22361e438795ace05a1f8625dcf27268138095093e65c04aad722864223a59e01f1812673b68
|
data/.travis.yml
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
@issues
|
2
|
+
Feature: Issues
|
3
|
+
As a user of the teelogger gem
|
4
|
+
When I file an issue
|
5
|
+
I expect a regression test from it
|
6
|
+
|
7
|
+
@issue_7
|
8
|
+
Scenario: Complex data causes exception in filter
|
9
|
+
Given I create a TeeLogger for regression testing issues
|
10
|
+
And I log complex data
|
11
|
+
Then I expect there not to be an exception
|
@@ -17,7 +17,7 @@ Given(/^I call it with parameters "([^"]*)", "([^"]*)", "([^"]*)" and "([^"]*)"$
|
|
17
17
|
# machines.
|
18
18
|
zone = ENV["TZ"]
|
19
19
|
ENV["TZ"] = "UTC"
|
20
|
-
t = Time.parse(time)
|
20
|
+
t = Time.parse(time).localtime
|
21
21
|
ENV["TZ"] = zone
|
22
22
|
|
23
23
|
result = formatter.call(severity, t, progname, message)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
io = nil
|
2
|
+
logger = nil
|
3
|
+
error = nil
|
4
|
+
|
5
|
+
Given(/^I create a TeeLogger for regression testing issues$/) do
|
6
|
+
io = StringIO.new
|
7
|
+
logger = TeeLogger::TeeLogger.new io
|
8
|
+
assert [TeeLogger::DEFAULT_FLUSH_INTERVAL] == logger.flush_interval, "Flush interval is not default: #{logger.flush_interval}"
|
9
|
+
end
|
10
|
+
|
11
|
+
Given(/^I log complex data$/) do
|
12
|
+
# Reduced data from issue #7
|
13
|
+
data = {
|
14
|
+
"status" => 200,
|
15
|
+
"result" => {
|
16
|
+
"id" => 123,
|
17
|
+
"caps" => [
|
18
|
+
{
|
19
|
+
"first" => [42],
|
20
|
+
"second" => ["some string"],
|
21
|
+
},
|
22
|
+
],
|
23
|
+
},
|
24
|
+
}
|
25
|
+
|
26
|
+
begin
|
27
|
+
logger.error(data)
|
28
|
+
error = nil
|
29
|
+
rescue StandardError => err
|
30
|
+
error = err
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
Then(/^I expect there not to be an exception$/) do
|
35
|
+
assert error.nil?, "Expected no error, but got: #{error}"
|
36
|
+
end
|
data/features/support/env.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require "codeclimate-test-reporter"
|
2
2
|
CodeClimate::TestReporter.start
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
# Simple assert function
|
5
|
+
def assert(condition, message = "Unknown reason")
|
6
|
+
if not condition
|
7
|
+
raise message
|
8
|
+
end
|
8
9
|
end
|
9
10
|
|
10
11
|
require "teelogger"
|
data/lib/teelogger.rb
CHANGED
data/lib/teelogger/filter.rb
CHANGED
@@ -20,35 +20,42 @@ module TeeLogger
|
|
20
20
|
# For each argument, recurse processing. Note that due to the window
|
21
21
|
# size of one, args is only an element long - but let's write this out
|
22
22
|
# properly.
|
23
|
+
processed_args = []
|
24
|
+
|
23
25
|
args.each do |arg|
|
24
|
-
#
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
# So we have an Enumerable, but we don't know whether it's Array-like
|
27
|
+
# or Hash-like. We'll check whether it responds to ".keys", and then
|
28
|
+
# treat it as a Hash.
|
29
|
+
processed = nil
|
30
|
+
if arg.respond_to? :keys
|
31
|
+
processed = {}
|
32
|
+
# Looks like a Hash, treat it like a Hash
|
33
|
+
arg.each do |key, value|
|
34
|
+
|
35
|
+
# If the key is a match, we'll just redact the entire value.
|
33
36
|
redacted = false
|
34
37
|
run_data[:words].each do |word|
|
35
38
|
if word.match(key.to_s)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
+
processed[key] = ::TeeLogger::Filter::REDACTED_WORD
|
40
|
+
redacted = true
|
41
|
+
break
|
39
42
|
end
|
40
43
|
end
|
41
44
|
|
45
|
+
# Otherwise, pass it through
|
42
46
|
if not redacted
|
43
|
-
|
47
|
+
processed[key] = run_data[:filters].apply_filters_internal(run_data, value)[0]
|
44
48
|
end
|
45
|
-
else
|
46
|
-
arg = run_data[:filters].apply_filters_internal(run_data, expanded)
|
47
49
|
end
|
50
|
+
else
|
51
|
+
# Treat it like an Array
|
52
|
+
processed = run_data[:filters].apply_filters_internal(run_data, *arg)
|
48
53
|
end
|
54
|
+
|
55
|
+
processed_args << processed
|
49
56
|
end
|
50
57
|
|
51
|
-
return
|
58
|
+
return processed_args
|
52
59
|
end
|
53
60
|
end # class Recursive
|
54
61
|
end # module Filter
|
data/lib/teelogger/version.rb
CHANGED
data/teelogger.gemspec
CHANGED
@@ -19,9 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
-
spec.add_development_dependency "rake"
|
23
|
-
spec.add_development_dependency "cucumber"
|
24
|
-
spec.add_development_dependency "minitest"
|
22
|
+
spec.add_development_dependency "rake", "~> 0"
|
23
|
+
spec.add_development_dependency "cucumber", "~> 0"
|
25
24
|
|
26
25
|
spec.add_dependency "tai64", "~> 0.0"
|
27
26
|
spec.add_dependency "require_all", "~> 1.3"
|
metadata
CHANGED
@@ -1,97 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teelogger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.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-07-
|
11
|
+
date: 2015-07-07 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
|
-
- -
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - '>='
|
52
|
+
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: tai64
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- - ~>
|
59
|
+
- - "~>"
|
74
60
|
- !ruby/object:Gem::Version
|
75
61
|
version: '0.0'
|
76
62
|
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - ~>
|
66
|
+
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0.0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: require_all
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- - ~>
|
73
|
+
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
75
|
version: '1.3'
|
90
76
|
type: :runtime
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- - ~>
|
80
|
+
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '1.3'
|
97
83
|
description: Mini wrapper around Ruby Logger for logging to multiple destinations.
|
@@ -101,17 +87,19 @@ executables: []
|
|
101
87
|
extensions: []
|
102
88
|
extra_rdoc_files: []
|
103
89
|
files:
|
104
|
-
- .gitignore
|
105
|
-
- .travis.yml
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
106
92
|
- Gemfile
|
107
93
|
- LICENSE
|
108
94
|
- README.md
|
109
95
|
- Rakefile
|
110
96
|
- features/filter.feature
|
111
97
|
- features/formatter.feature
|
98
|
+
- features/issues.feature
|
112
99
|
- features/logger.feature
|
113
100
|
- features/step_definitions/filter_steps.rb
|
114
101
|
- features/step_definitions/formatter_steps.rb
|
102
|
+
- features/step_definitions/issue_steps.rb
|
115
103
|
- features/step_definitions/logger_steps.rb
|
116
104
|
- features/support/env.rb
|
117
105
|
- lib/teelogger.rb
|
@@ -134,25 +122,27 @@ require_paths:
|
|
134
122
|
- lib
|
135
123
|
required_ruby_version: !ruby/object:Gem::Requirement
|
136
124
|
requirements:
|
137
|
-
- -
|
125
|
+
- - ">="
|
138
126
|
- !ruby/object:Gem::Version
|
139
127
|
version: '0'
|
140
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
129
|
requirements:
|
142
|
-
- -
|
130
|
+
- - ">="
|
143
131
|
- !ruby/object:Gem::Version
|
144
132
|
version: '0'
|
145
133
|
requirements: []
|
146
134
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.2.3
|
148
136
|
signing_key:
|
149
137
|
specification_version: 4
|
150
138
|
summary: Mini wrapper around Ruby Logger for logging to multiple destinations.
|
151
139
|
test_files:
|
152
140
|
- features/filter.feature
|
153
141
|
- features/formatter.feature
|
142
|
+
- features/issues.feature
|
154
143
|
- features/logger.feature
|
155
144
|
- features/step_definitions/filter_steps.rb
|
156
145
|
- features/step_definitions/formatter_steps.rb
|
146
|
+
- features/step_definitions/issue_steps.rb
|
157
147
|
- features/step_definitions/logger_steps.rb
|
158
148
|
- features/support/env.rb
|