logging 1.4.3 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/History.txt +8 -0
  2. data/Rakefile +2 -4
  3. data/examples/colorization.rb +62 -0
  4. data/lib/logging.rb +22 -8
  5. data/lib/logging/appender.rb +7 -7
  6. data/lib/logging/appenders/buffering.rb +30 -24
  7. data/lib/logging/appenders/email.rb +7 -11
  8. data/lib/logging/appenders/file.rb +0 -1
  9. data/lib/logging/appenders/io.rb +8 -14
  10. data/lib/logging/appenders/rolling_file.rb +9 -13
  11. data/lib/logging/appenders/string_io.rb +0 -1
  12. data/lib/logging/appenders/syslog.rb +1 -1
  13. data/lib/logging/color_scheme.rb +249 -0
  14. data/lib/logging/layouts/basic.rb +2 -3
  15. data/lib/logging/layouts/parseable.rb +5 -7
  16. data/lib/logging/layouts/pattern.rb +77 -18
  17. data/lib/logging/log_event.rb +1 -1
  18. data/lib/logging/logger.rb +3 -4
  19. data/lib/logging/proxy.rb +57 -0
  20. data/lib/logging/utils.rb +3 -2
  21. data/test/appenders/test_buffered_io.rb +2 -7
  22. data/test/appenders/test_console.rb +1 -1
  23. data/test/appenders/test_email.rb +1 -1
  24. data/test/appenders/test_file.rb +1 -1
  25. data/test/appenders/test_growl.rb +1 -1
  26. data/test/appenders/test_io.rb +4 -5
  27. data/test/appenders/test_rolling_file.rb +1 -1
  28. data/test/appenders/test_syslog.rb +1 -1
  29. data/test/benchmark.rb +15 -11
  30. data/test/config/test_configurator.rb +1 -1
  31. data/test/config/test_yaml_configurator.rb +1 -1
  32. data/test/layouts/test_basic.rb +1 -1
  33. data/test/layouts/test_color_pattern.rb +90 -0
  34. data/test/layouts/test_json.rb +1 -1
  35. data/test/layouts/test_pattern.rb +4 -5
  36. data/test/layouts/test_yaml.rb +1 -1
  37. data/test/test_appender.rb +1 -1
  38. data/test/test_color_scheme.rb +39 -0
  39. data/test/test_consolidate.rb +1 -1
  40. data/test/test_layout.rb +1 -1
  41. data/test/test_log_event.rb +1 -1
  42. data/test/test_logger.rb +1 -1
  43. data/test/test_logging.rb +1 -1
  44. data/test/test_proxy.rb +67 -0
  45. data/test/test_repository.rb +2 -2
  46. data/test/test_root_logger.rb +1 -1
  47. data/test/test_stats.rb +1 -1
  48. data/test/test_utils.rb +1 -1
  49. data/version.txt +1 -1
  50. metadata +40 -17
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), %w[setup])
2
+ require File.expand_path('setup', File.dirname(__FILE__))
3
3
 
4
4
  module TestLogging
5
5
 
data/test/test_layout.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), %w[setup])
2
+ require File.expand_path('setup', File.dirname(__FILE__))
3
3
 
4
4
  module TestLogging
5
5
 
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), %w[setup])
2
+ require File.expand_path('setup', File.dirname(__FILE__))
3
3
 
4
4
  module TestLogging
5
5
 
data/test/test_logger.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), %w[setup])
2
+ require File.expand_path('setup', File.dirname(__FILE__))
3
3
 
4
4
  module TestLogging
5
5
 
data/test/test_logging.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), %w[setup])
2
+ require File.expand_path('setup', File.dirname(__FILE__))
3
3
 
4
4
  module TestLogging
5
5
 
@@ -0,0 +1,67 @@
1
+
2
+ require File.expand_path('../setup', __FILE__)
3
+
4
+ module TestLogging
5
+
6
+ class TestProxy < Test::Unit::TestCase
7
+ include LoggingTestCase
8
+
9
+ def setup
10
+ super
11
+
12
+ ::Logging.init
13
+ @appender = Logging.appenders.string_io('test_appender')
14
+ logger = Logging.logger[Array]
15
+ logger.level = :debug
16
+ logger.appenders = @appender
17
+ end
18
+
19
+ def test_initialize
20
+ ary = []
21
+ proxy = Logging::Proxy.new ary
22
+
23
+ assert_instance_of Array, proxy
24
+
25
+ proxy.concat [1,2,3]
26
+ assert_equal 3, proxy.length
27
+ assert_equal [1,2,3], ary
28
+ end
29
+
30
+ def test_method_logging
31
+ proxy = Logging::Proxy.new []
32
+ assert_equal 0, proxy.length
33
+ assert_equal "Array#length()\n", @appender.readline
34
+
35
+ proxy.concat [1,2,3]
36
+ assert_equal "Array#concat(#{[1,2,3].inspect})\n", @appender.readline
37
+
38
+ proxy = Logging::Proxy.new Array
39
+ proxy.name
40
+ assert_equal "Array.name()\n", @appender.readline
41
+
42
+ proxy.new 0
43
+ assert_equal "Array.new(0)\n", @appender.readline
44
+ end
45
+
46
+ def test_custom_method_logging
47
+ proxy = Logging::Proxy.new([]) { |name, *args, &block|
48
+ @logger << "#@leader#{name}(#{args.inspect[1..-2]})"
49
+ rv = @object.__send__(name, *args, &block)
50
+ @logger << " => #{rv.inspect}\n"
51
+ rv
52
+ }
53
+ @appender.clear
54
+
55
+ assert_equal 0, proxy.length
56
+ assert_equal "Array#length() => 0\n", @appender.readline
57
+
58
+ proxy.concat [1,2,3]
59
+ assert_equal "Array#concat(#{[1,2,3].inspect}) => #{[1,2,3].inspect}\n", @appender.readline
60
+
61
+ proxy.concat [4,5,6]
62
+ assert_equal "Array#concat(#{[4,5,6].inspect}) => #{[1,2,3,4,5,6].inspect}\n", @appender.readline
63
+ end
64
+
65
+ end # TestProxy
66
+ end # TestLogging
67
+
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), %w[setup])
2
+ require File.expand_path('setup', File.dirname(__FILE__))
3
3
 
4
4
  module TestLogging
5
5
 
@@ -122,7 +122,7 @@ module TestLogging
122
122
 
123
123
  def test_add_master
124
124
  ary = @repo.instance_variable_get(:@masters)
125
- assert true, ary.empty?
125
+ assert ary.empty?
126
126
 
127
127
  @repo.add_master 'root'
128
128
  assert_equal [:root], ary
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), %w[setup])
2
+ require File.expand_path('setup', File.dirname(__FILE__))
3
3
 
4
4
  module TestLogging
5
5
 
data/test/test_stats.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), %w[setup])
2
+ require File.expand_path('setup', File.dirname(__FILE__))
3
3
 
4
4
  module TestLogging
5
5
  module TestStats
data/test/test_utils.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- require File.join(File.dirname(__FILE__), %w[setup])
2
+ require File.expand_path('setup', File.dirname(__FILE__))
3
3
 
4
4
  module TestLogging
5
5
 
data/version.txt CHANGED
@@ -1 +1 @@
1
- 1.4.3
1
+ 1.5.0
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logging
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 3
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
- - 4
8
- - 3
9
- version: 1.4.3
8
+ - 5
9
+ - 0
10
+ version: 1.5.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Tim Pease
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-31 00:00:00 -06:00
18
+ date: 2011-03-22 00:00:00 -06:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: little-plugger
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 23
27
30
  segments:
28
31
  - 1
29
32
  - 1
@@ -35,56 +38,64 @@ dependencies:
35
38
  name: flexmock
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 41
41
46
  segments:
42
47
  - 0
43
48
  - 8
44
- - 6
45
- version: 0.8.6
49
+ - 11
50
+ version: 0.8.11
46
51
  type: :development
47
52
  version_requirements: *id002
48
53
  - !ruby/object:Gem::Dependency
49
54
  name: bones-git
50
55
  prerelease: false
51
56
  requirement: &id003 !ruby/object:Gem::Requirement
57
+ none: false
52
58
  requirements:
53
59
  - - ">="
54
60
  - !ruby/object:Gem::Version
61
+ hash: 23
55
62
  segments:
56
63
  - 1
57
- - 1
58
64
  - 2
59
- version: 1.1.2
65
+ - 4
66
+ version: 1.2.4
60
67
  type: :development
61
68
  version_requirements: *id003
62
69
  - !ruby/object:Gem::Dependency
63
- name: bones-extras
70
+ name: bones-rcov
64
71
  prerelease: false
65
72
  requirement: &id004 !ruby/object:Gem::Requirement
73
+ none: false
66
74
  requirements:
67
75
  - - ">="
68
76
  - !ruby/object:Gem::Version
77
+ hash: 21
69
78
  segments:
70
79
  - 1
71
- - 2
72
- - 3
73
- version: 1.2.3
80
+ - 0
81
+ - 1
82
+ version: 1.0.1
74
83
  type: :development
75
84
  version_requirements: *id004
76
85
  - !ruby/object:Gem::Dependency
77
86
  name: bones
78
87
  prerelease: false
79
88
  requirement: &id005 !ruby/object:Gem::Requirement
89
+ none: false
80
90
  requirements:
81
91
  - - ">="
82
92
  - !ruby/object:Gem::Version
93
+ hash: 21
83
94
  segments:
84
95
  - 3
85
- - 4
86
- - 3
87
- version: 3.4.3
96
+ - 6
97
+ - 5
98
+ version: 3.6.5
88
99
  type: :development
89
100
  version_requirements: *id005
90
101
  description: |-
@@ -100,7 +111,6 @@ extensions: []
100
111
  extra_rdoc_files:
101
112
  - History.txt
102
113
  - README.rdoc
103
- - version.txt
104
114
  files:
105
115
  - History.txt
106
116
  - README.rdoc
@@ -112,6 +122,7 @@ files:
112
122
  - data/simple_logging.rb
113
123
  - examples/appenders.rb
114
124
  - examples/classes.rb
125
+ - examples/colorization.rb
115
126
  - examples/consolidation.rb
116
127
  - examples/fork.rb
117
128
  - examples/formatting.rb
@@ -132,6 +143,7 @@ files:
132
143
  - lib/logging/appenders/rolling_file.rb
133
144
  - lib/logging/appenders/string_io.rb
134
145
  - lib/logging/appenders/syslog.rb
146
+ - lib/logging/color_scheme.rb
135
147
  - lib/logging/config/configurator.rb
136
148
  - lib/logging/config/yaml_configurator.rb
137
149
  - lib/logging/layout.rb
@@ -141,6 +153,7 @@ files:
141
153
  - lib/logging/layouts/pattern.rb
142
154
  - lib/logging/log_event.rb
143
155
  - lib/logging/logger.rb
156
+ - lib/logging/proxy.rb
144
157
  - lib/logging/repository.rb
145
158
  - lib/logging/root_logger.rb
146
159
  - lib/logging/stats.rb
@@ -158,16 +171,19 @@ files:
158
171
  - test/config/test_configurator.rb
159
172
  - test/config/test_yaml_configurator.rb
160
173
  - test/layouts/test_basic.rb
174
+ - test/layouts/test_color_pattern.rb
161
175
  - test/layouts/test_json.rb
162
176
  - test/layouts/test_pattern.rb
163
177
  - test/layouts/test_yaml.rb
164
178
  - test/setup.rb
165
179
  - test/test_appender.rb
180
+ - test/test_color_scheme.rb
166
181
  - test/test_consolidate.rb
167
182
  - test/test_layout.rb
168
183
  - test/test_log_event.rb
169
184
  - test/test_logger.rb
170
185
  - test/test_logging.rb
186
+ - test/test_proxy.rb
171
187
  - test/test_repository.rb
172
188
  - test/test_root_logger.rb
173
189
  - test/test_stats.rb
@@ -184,23 +200,27 @@ rdoc_options:
184
200
  require_paths:
185
201
  - lib
186
202
  required_ruby_version: !ruby/object:Gem::Requirement
203
+ none: false
187
204
  requirements:
188
205
  - - ">="
189
206
  - !ruby/object:Gem::Version
207
+ hash: 3
190
208
  segments:
191
209
  - 0
192
210
  version: "0"
193
211
  required_rubygems_version: !ruby/object:Gem::Requirement
212
+ none: false
194
213
  requirements:
195
214
  - - ">="
196
215
  - !ruby/object:Gem::Version
216
+ hash: 3
197
217
  segments:
198
218
  - 0
199
219
  version: "0"
200
220
  requirements: []
201
221
 
202
222
  rubyforge_project: logging
203
- rubygems_version: 1.3.6
223
+ rubygems_version: 1.3.7
204
224
  signing_key:
205
225
  specification_version: 3
206
226
  summary: A flexible and extendable logging library for Ruby
@@ -216,15 +236,18 @@ test_files:
216
236
  - test/config/test_configurator.rb
217
237
  - test/config/test_yaml_configurator.rb
218
238
  - test/layouts/test_basic.rb
239
+ - test/layouts/test_color_pattern.rb
219
240
  - test/layouts/test_json.rb
220
241
  - test/layouts/test_pattern.rb
221
242
  - test/layouts/test_yaml.rb
222
243
  - test/test_appender.rb
244
+ - test/test_color_scheme.rb
223
245
  - test/test_consolidate.rb
224
246
  - test/test_layout.rb
225
247
  - test/test_log_event.rb
226
248
  - test/test_logger.rb
227
249
  - test/test_logging.rb
250
+ - test/test_proxy.rb
228
251
  - test/test_repository.rb
229
252
  - test/test_root_logger.rb
230
253
  - test/test_stats.rb