trace-util-adv 0.3.0 → 0.3.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.
- data/Rakefile +2 -0
- data/TODO.txt +9 -23
- data/VERSION +1 -1
- data/lib/filters/include.rb +1 -0
- data/lib/filters/simple/instance_var_filter.rb +13 -11
- data/lib/templates/base_template.rb +0 -2
- data/lib/trace_calls/trace_calls.rb +0 -2
- data/lib/trace_calls/trace_ext.rb +1 -9
- data/test/filters/simple/test_instancevar_filter.rb +64 -39
- data/test/listeners/test_listeners.rb +0 -0
- data/trace-util-adv.gemspec +6 -2
- metadata +13 -2
data/Rakefile
CHANGED
@@ -14,6 +14,8 @@ begin
|
|
14
14
|
gem.authors = ["Kristian Mandrup"]
|
15
15
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
16
16
|
gem.files.exclude 'test', 'log_files'
|
17
|
+
gem.add_dependency 'require-magic'
|
18
|
+
|
17
19
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
20
|
end
|
19
21
|
Jeweler::GemcutterTasks.new
|
data/TODO.txt
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
TODO:
|
2
2
|
----
|
3
|
+
|
4
|
+
=====
|
5
|
+
0.4.0
|
6
|
+
=====
|
3
7
|
- Clean up Appenders, Templates and Targets
|
4
|
-
- Convenience Appenders
|
8
|
+
- Convenience Appenders?
|
5
9
|
- LogFile
|
6
10
|
- HtmlFile
|
7
11
|
- XmlFile
|
@@ -13,12 +17,11 @@ TODO:
|
|
13
17
|
- File
|
14
18
|
- String
|
15
19
|
- Stream (STDOUT, STDERR)
|
16
|
-
- Stack
|
17
|
-
|
18
|
-
- Add listener to Target?
|
19
|
-
|
20
|
-
- Simplify with Listener model?
|
20
|
+
- Stack (of Strings and/or Events?)
|
21
21
|
|
22
|
+
- Simplify with Listener model?
|
23
|
+
- Add listeners to Target and/or Appender?
|
24
|
+
|
22
25
|
---
|
23
26
|
Add time to context for before- and after handle calls. Enable tracing time output
|
24
27
|
Allow for comparing time it takes to complete method and act upon it!
|
@@ -34,24 +37,7 @@ Introduce new rule outcomes
|
|
34
37
|
:include_yield - set temp outcome to include and then yield, allowing other rule to exclude
|
35
38
|
:exclude_yield - set temp outcome to exclude and then yield, allowing other rule to include
|
36
39
|
|
37
|
-
Refactor MsgContextRule
|
38
|
-
-----------------------
|
39
|
-
- see message_filters.rb
|
40
|
-
- BaseFilter should extend this.
|
41
|
-
|
42
|
-
Refactor design
|
43
|
-
- Modularize even more!
|
44
|
-
|
45
|
-
Test String appender
|
46
|
-
- log string to file
|
47
|
-
|
48
|
-
Test library in general
|
49
|
-
- functions as expected?
|
50
|
-
- easy to use?
|
51
40
|
- create RSpec tests?
|
52
41
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
42
|
ExtJS:
|
57
43
|
http://www.extjswithrails.com/2008/03/fitting-ext-js-into-rails-architecture.html
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/lib/filters/include.rb
CHANGED
@@ -5,23 +5,25 @@ module Tracing
|
|
5
5
|
|
6
6
|
def initialize(options)
|
7
7
|
super(options)
|
8
|
-
|
8
|
+
puts "create inst.var filter: #{options.inspect}"
|
9
9
|
@rules = options[:var_rules] || options[:vars_filter] || {}
|
10
10
|
@var_name = options[:var_name]
|
11
|
+
@on_class = options[:class] || false
|
11
12
|
end
|
12
13
|
|
13
14
|
def allow_action(msg, context)
|
14
15
|
puts "InstanceVarFilter.allow_action"
|
15
|
-
obj = context[:self]
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
# obj = context[:self]
|
17
|
+
# obj = obj.class if @on_class
|
18
|
+
# puts "var_name: #{var_name}"
|
19
|
+
# if var_name.kind_of?(Symbol) || var_name.kind_of?(String)
|
20
|
+
# value = obj.instance_variable_get("@#{var_name}")
|
21
|
+
# puts "value: #{value}"
|
22
|
+
# return name_allow_action(value)
|
23
|
+
# else
|
24
|
+
# puts "return default :yield"
|
25
|
+
# :yield
|
26
|
+
# end
|
25
27
|
end
|
26
28
|
|
27
29
|
end
|
@@ -1,14 +1,6 @@
|
|
1
|
-
require 'extensions/include'
|
2
|
-
require 'appenders/include'
|
3
|
-
require "templates/include"
|
4
|
-
require 'output_handler/output_handler'
|
5
|
-
require 'action_handler/action_handler'
|
6
|
-
require 'filters/filter_use'
|
7
|
-
require "duration"
|
8
|
-
|
9
1
|
module Tracing
|
10
2
|
module TraceExt
|
11
|
-
|
3
|
+
Tracing::Filter::Executor
|
12
4
|
|
13
5
|
class << self
|
14
6
|
attr_accessor :configuration
|
@@ -10,6 +10,16 @@ InstanceVar_filter = {
|
|
10
10
|
}
|
11
11
|
}
|
12
12
|
|
13
|
+
InstanceVar_filter2 = {
|
14
|
+
:name => 'check template path',
|
15
|
+
:var_name => 'template_path',
|
16
|
+
:var_rules => {
|
17
|
+
:include => [/taglib/],
|
18
|
+
:exclude => [/rapid/],
|
19
|
+
:default => :exclude
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
13
23
|
class Obj
|
14
24
|
attr_accessor :template_path
|
15
25
|
|
@@ -20,30 +30,32 @@ end
|
|
20
30
|
|
21
31
|
class TestInstanceVarFilter < Test::Unit::TestCase
|
22
32
|
|
23
|
-
def test_varfilter_hash_to_class
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_varfilter_hash_to_class
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
def test_varfilter_from_hash
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
33
|
+
# def test_varfilter_hash_to_class
|
34
|
+
# var_filter = InstanceVar_filter
|
35
|
+
# result = var_filter.filter_class
|
36
|
+
# assert_equal Tracing::InstanceVarFilter, result, "Should result in var filter"
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# def test_varfilter_hash_to_class
|
40
|
+
# var_filter = InstanceVar_filter
|
41
|
+
# result = var_filter.create_filter
|
42
|
+
# assert_equal Tracing::InstanceVarFilter, result.class, "Should result in var filter"
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
#
|
46
|
+
# def test_varfilter_from_hash
|
47
|
+
# var_filter = InstanceVar_filter
|
48
|
+
# config = {:filters => var_filter}
|
49
|
+
# result = config.filters
|
50
|
+
# assert_equal Tracing::InstanceVarFilter, result.class, "Should result in var filter"
|
51
|
+
# end
|
42
52
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
53
|
+
def test_varfilter__class_and_varmatch_2
|
54
|
+
var_filter = InstanceVar_filter2
|
55
|
+
obj = Obj.new("taglib")
|
56
|
+
|
57
|
+
puts obj.inspect
|
58
|
+
context = {:class_name => "Hobo::Dryml", :vars => ["template_path"], :self => obj }.context
|
47
59
|
|
48
60
|
options = {:filters => var_filter}
|
49
61
|
exec = Tracing::Filter::Executor.new(options)
|
@@ -52,27 +64,40 @@ class TestInstanceVarFilter < Test::Unit::TestCase
|
|
52
64
|
assert_equal true, result, "Filter should allow passage"
|
53
65
|
end
|
54
66
|
|
55
|
-
|
67
|
+
|
68
|
+
# see allow_action in InstanceVarFilter, refactor :yield, :include .. as return values!?
|
69
|
+
def test_varfilter__class_and_varmatch
|
56
70
|
var_filter = InstanceVar_filter
|
71
|
+
context = {:class_name => "Hobo::Dryml", :vars => ["template_path"], :self => Obj.new("a/taglib/x") }.context
|
57
72
|
|
58
|
-
context = {:class_name => 'Blip::Blap', :vars => {"template_path" => "a/taglib/x"}, :self => Obj.new("taglib/x") }.context
|
59
|
-
|
60
|
-
puts "Context:" + context.inspect
|
61
|
-
|
62
73
|
options = {:filters => var_filter}
|
63
74
|
exec = Tracing::Filter::Executor.new(options)
|
64
75
|
result = exec.filters_allow?('msg', context)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
def test_varfilter__varexcluded
|
69
|
-
var_filter = InstanceVar_filter
|
70
|
-
context = {:class_name => 'Blip::Blap', :vars => {"template_path" => "a/taglib/x"}, :self => Obj.new("a/rapid_x") }.context
|
71
|
-
|
72
|
-
options = {:filters => var_filter}
|
73
|
-
exec = Tracing::Filter::Executor.new(options)
|
74
|
-
result = exec.filters_allow?('msg', context)
|
75
|
-
assert_equal false, result, "Filter should NOT allow passage"
|
76
|
+
|
77
|
+
assert_equal true, result, "Filter should allow passage"
|
76
78
|
end
|
79
|
+
|
80
|
+
# def test_varfilter__varnot_match
|
81
|
+
# var_filter = InstanceVar_filter
|
82
|
+
#
|
83
|
+
# context = {:class_name => 'Blip::Blap', :vars => ["template_path" => "a/taglib/x"], :self => Obj.new("taglib/x") }.context
|
84
|
+
#
|
85
|
+
# puts "Context:" + context.inspect
|
86
|
+
#
|
87
|
+
# options = {:filters => var_filter}
|
88
|
+
# exec = Tracing::Filter::Executor.new(options)
|
89
|
+
# result = exec.filters_allow?('msg', context)
|
90
|
+
# assert_equal false, result, "Filter should NOT allow passage"
|
91
|
+
# end
|
92
|
+
#
|
93
|
+
# def test_varfilter__varexcluded
|
94
|
+
# var_filter = InstanceVar_filter
|
95
|
+
# context = {:class_name => 'Blip::Blap', :vars => ["template_path" => "a/taglib/x"], :self => Obj.new("a/rapid_x") }.context
|
96
|
+
#
|
97
|
+
# options = {:filters => var_filter}
|
98
|
+
# exec = Tracing::Filter::Executor.new(options)
|
99
|
+
# result = exec.filters_allow?('msg', context)
|
100
|
+
# assert_equal false, result, "Filter should NOT allow passage"
|
101
|
+
# end
|
77
102
|
|
78
103
|
end
|
File without changes
|
data/trace-util-adv.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{trace-util-adv}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-22}
|
13
13
|
s.description = %q{
|
14
14
|
Configure tracing using context sensitive filters, appenders, output templates in a completely non-intrusive fashion.
|
15
15
|
Tracing can even be applied runtime as a response when certain conditions occur}
|
@@ -133,6 +133,7 @@ Gem::Specification.new do |s|
|
|
133
133
|
"test/filters/simple/test_instancevar_filter.rb",
|
134
134
|
"test/filters/simple/test_method_filter.rb",
|
135
135
|
"test/filters/simple/test_module_filter.rb",
|
136
|
+
"test/listeners/test_listeners.rb",
|
136
137
|
"test/samples/include.rb",
|
137
138
|
"test/samples/sample_classes.rb",
|
138
139
|
"test/samples/sample_composite_filters.rb",
|
@@ -159,11 +160,14 @@ Gem::Specification.new do |s|
|
|
159
160
|
|
160
161
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
161
162
|
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
163
|
+
s.add_runtime_dependency(%q<require-magic>, [">= 0"])
|
162
164
|
else
|
163
165
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
166
|
+
s.add_dependency(%q<require-magic>, [">= 0"])
|
164
167
|
end
|
165
168
|
else
|
166
169
|
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
170
|
+
s.add_dependency(%q<require-magic>, [">= 0"])
|
167
171
|
end
|
168
172
|
end
|
169
173
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trace-util-adv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kristian Mandrup
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-22 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,6 +22,16 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 1.2.9
|
24
24
|
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: require-magic
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
25
35
|
description: |-
|
26
36
|
|
27
37
|
Configure tracing using context sensitive filters, appenders, output templates in a completely non-intrusive fashion.
|
@@ -171,6 +181,7 @@ test_files:
|
|
171
181
|
- test/filters/simple/test_instancevar_filter.rb
|
172
182
|
- test/filters/simple/test_method_filter.rb
|
173
183
|
- test/filters/simple/test_module_filter.rb
|
184
|
+
- test/listeners/test_listeners.rb
|
174
185
|
- test/samples/include.rb
|
175
186
|
- test/samples/sample_classes.rb
|
176
187
|
- test/samples/sample_composite_filters.rb
|