logging 2.2.1 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,8 +4,7 @@ module Logging
4
4
  module Filters
5
5
 
6
6
  # The `Level` filter class provides a simple level-based filtering mechanism
7
- # that filters messages to only include those from an enumerated list of
8
- # levels to log.
7
+ # that allows events whose log level matches a preconfigured list of values.
9
8
  class Level < ::Logging::Filter
10
9
 
11
10
  # Creates a new level filter that will only allow the given _levels_ to
@@ -15,15 +14,19 @@ module Logging
15
14
  # Examples
16
15
  # Logging::Filters::Level.new(:debug, :info)
17
16
  #
18
- def initialize( *levels )
19
- levels = levels.map { |level| ::Logging::level_num(level) }
20
- @levels = Set.new levels
17
+ def initialize(*levels)
18
+ super()
19
+ levels = levels.flatten.map {|level| ::Logging::level_num(level)}
20
+ @levels = Set.new(levels)
21
21
  end
22
22
 
23
- def allow( event )
23
+ # Returns the event if it should be forwarded to the logging appender.
24
+ # Otherwise, `nil` is returned. The log event is allowed if the
25
+ # `event.level` matches one of the levels provided to the filter when it
26
+ # was constructred.
27
+ def allow(event)
24
28
  @levels.include?(event.level) ? event : nil
25
29
  end
26
-
27
30
  end
28
31
  end
29
32
  end
@@ -1,4 +1,4 @@
1
1
  module Logging
2
2
  module Filters ; end
3
3
  require libpath('logging/filters/level')
4
- end
4
+ end
@@ -41,8 +41,9 @@ class Layout
41
41
  when :inspect, :yaml, :json; f
42
42
  else :string end
43
43
 
44
- self.backtrace = opts.fetch(:backtrace, ::Logging.backtrace)
45
- self.utc_offset = opts.fetch(:utc_offset, ::Logging.utc_offset)
44
+ self.backtrace = opts.fetch(:backtrace, ::Logging.backtrace)
45
+ self.utc_offset = opts.fetch(:utc_offset, ::Logging.utc_offset)
46
+ self.cause_depth = opts.fetch(:cause_depth, ::Logging.cause_depth)
46
47
  end
47
48
 
48
49
  # call-seq:
@@ -89,6 +90,20 @@ class Layout
89
90
  # Returns the UTC offset.
90
91
  attr_reader :utc_offset
91
92
 
93
+ #
94
+ #
95
+ def cause_depth=( value )
96
+ if value.nil?
97
+ @cause_depth = ::Logging::DEFAULT_CAUSE_DEPTH
98
+ else
99
+ value = Integer(value)
100
+ @cause_depth = value < 0 ? ::Logging::DEFAULT_CAUSE_DEPTH : value
101
+ end
102
+ end
103
+
104
+ # Returns the exception cause depth formatting limit.
105
+ attr_reader :cause_depth
106
+
92
107
  # Internal: Helper method that applies the UTC offset to the given `time`
93
108
  # instance. A new Time is returned that is equivalent to the original `time`
94
109
  # but pinned to the timezone given by the UTC offset.
@@ -142,15 +157,10 @@ class Layout
142
157
  case obj
143
158
  when String; obj
144
159
  when Exception
145
- ary = ["<#{obj.class.name}> #{obj.message}"]
146
- if backtrace? && !obj.backtrace.nil?
147
- ary.concat(obj.backtrace)
148
- end
149
- if defined?(obj.cause) && !obj.cause.nil?
150
- ary << "--- Caused by ---"
151
- ary << format_obj(obj.cause)
152
- end
153
- ary.join("\n\t")
160
+ lines = ["<#{obj.class.name}> #{obj.message}"]
161
+ lines.concat(obj.backtrace) if backtrace? && obj.backtrace
162
+ format_cause(obj, lines)
163
+ lines.join("\n\t")
154
164
  when nil; "<#{obj.class.name}> nil"
155
165
  else
156
166
  str = "<#{obj.class.name}> "
@@ -163,6 +173,64 @@ class Layout
163
173
  end
164
174
  end
165
175
 
176
+ # Internal: Format any nested exceptions found in the given exception `e`
177
+ # while respecting the maximum `cause_depth`. The lines array is used to
178
+ # capture all the output lines form the nested exceptions; the array is later
179
+ # joined by the `format_obj` method.
180
+ #
181
+ # e - Exception to format
182
+ # lines - Array of output lines
183
+ #
184
+ # Returns the input `lines` Array
185
+ def format_cause(e, lines)
186
+ return lines if cause_depth == 0
187
+
188
+ cause_depth.times do
189
+ break unless e.respond_to?(:cause) && e.cause
190
+
191
+ cause = e.cause
192
+ lines << "--- Caused by ---"
193
+ lines << "<#{cause.class.name}> #{cause.message}"
194
+ lines.concat(format_cause_backtrace(e, cause)) if backtrace? && cause.backtrace
195
+
196
+ e = cause
197
+ end
198
+
199
+ if e.respond_to?(:cause) && e.cause
200
+ lines << "--- Further #cause backtraces were omitted ---"
201
+ end
202
+
203
+ lines
204
+ end
205
+
206
+ # Internal: Format the backtrace of the nested `cause` but remove the common
207
+ # exception lines from the parent exception. This helps keep the backtraces a
208
+ # wee bit shorter and more comprehensible.
209
+ #
210
+ # e - parent exception
211
+ # cause - the nested exception generating the returned backtrace
212
+ #
213
+ # Returns an Array of backtracke lines.
214
+ def format_cause_backtrace(e, cause)
215
+ # Find where the cause's backtrace differs from the parent exception's.
216
+ backtrace = Array(e.backtrace)
217
+ cause_backtrace = Array(cause.backtrace)
218
+ index = -1
219
+ min_index = [backtrace.size, cause_backtrace.size].min * -1
220
+ just_in_case = -5000
221
+
222
+ while index > min_index && backtrace[index] == cause_backtrace[index] && index >= just_in_case
223
+ index -= 1
224
+ end
225
+
226
+ # Add on a few common frames to make it clear where the backtraces line up.
227
+ index += 3
228
+ index = -1 if index >= 0
229
+
230
+ cause_backtrace[0..index]
231
+ end
232
+
233
+
166
234
  # Attempt to format the _obj_ using yaml, but fall back to inspect style
167
235
  # formatting if yaml fails.
168
236
  #
@@ -188,7 +256,5 @@ class Layout
188
256
  rescue StandardError
189
257
  obj.inspect
190
258
  end
191
-
192
- end # class Layout
193
- end # module Logging
194
-
259
+ end
260
+ end
@@ -103,7 +103,7 @@ module Logging::Layouts
103
103
  'message' => 'format_obj(event.data)'.freeze,
104
104
  'file' => 'event.file'.freeze,
105
105
  'line' => 'event.line'.freeze,
106
- 'method' => 'event.method'.freeze,
106
+ 'method' => 'event.method_name'.freeze,
107
107
  'hostname' => "'#{Socket.gethostname}'".freeze,
108
108
  'pid' => 'Process.pid'.freeze,
109
109
  'millis' => 'Integer((event.time-@created_at)*1000)'.freeze,
@@ -219,11 +219,15 @@ module Logging::Layouts
219
219
  def format_obj( obj )
220
220
  case obj
221
221
  when Exception
222
- h = { :class => obj.class.name,
223
- :message => obj.message }
224
- h[:backtrace] = obj.backtrace if backtrace? && !obj.backtrace.nil?
225
- h[:cause] = format_obj(obj.cause) if defined?(obj.cause) && !obj.cause.nil?
226
- h
222
+ hash = {
223
+ :class => obj.class.name,
224
+ :message => obj.message
225
+ }
226
+ hash[:backtrace] = obj.backtrace if backtrace? && obj.backtrace
227
+
228
+ cause = format_cause(obj)
229
+ hash[:cause] = cause unless cause.empty?
230
+ hash
227
231
  when Time
228
232
  iso8601_format(obj)
229
233
  else
@@ -231,6 +235,37 @@ module Logging::Layouts
231
235
  end
232
236
  end
233
237
 
238
+ # Internal: Format any nested exceptions found in the given exception `e`
239
+ # while respecting the maximum `cause_depth`.
240
+ #
241
+ # e - Exception to format
242
+ #
243
+ # Returns the cause formatted as a Hash
244
+ def format_cause(e)
245
+ rv = curr = {}
246
+ prev = nil
247
+
248
+ cause_depth.times do
249
+ break unless e.respond_to?(:cause) && e.cause
250
+
251
+ cause = e.cause
252
+ curr[:class] = cause.class.name
253
+ curr[:message] = cause.message
254
+ curr[:backtrace] = format_cause_backtrace(e, cause) if backtrace? && cause.backtrace
255
+
256
+ prev[:cause] = curr unless prev.nil?
257
+ prev, curr = curr, {}
258
+
259
+ e = cause
260
+ end
261
+
262
+ if e.respond_to?(:cause) && e.cause
263
+ prev[:cause] = {message: "Further #cause backtraces were omitted"}
264
+ end
265
+
266
+ rv
267
+ end
268
+
234
269
  private
235
270
 
236
271
  # Call the appropriate class level create format method based on the
@@ -258,6 +293,5 @@ module Logging::Layouts
258
293
  return str << (value.gmt_offset < 0 ? '-' : '+') << offset
259
294
  end
260
295
 
261
- end # Parseable
262
- end # Logging::Layouts
263
-
296
+ end
297
+ end
@@ -307,7 +307,7 @@ module Logging::Layouts
307
307
  'l' => '::Logging::LNAMES[event.level]'.freeze,
308
308
  'L' => 'event.line'.freeze,
309
309
  'm' => 'format_obj(event.data)'.freeze,
310
- 'M' => 'event.method'.freeze,
310
+ 'M' => 'event.method_name'.freeze,
311
311
  'h' => "'#{Socket.gethostname}'".freeze,
312
312
  'p' => 'Process.pid'.freeze,
313
313
  'r' => 'Integer((event.time-@created_at)*1000).to_s'.freeze,
@@ -12,10 +12,11 @@ module Logging
12
12
  # * $3 == method name (might be nil)
13
13
  CALLER_RGXP = %r/([-\.\/\(\)\w]+):(\d+)(?::in `([^']+)')?/o
14
14
  #CALLER_INDEX = 2
15
- CALLER_INDEX = ((defined? JRUBY_VERSION and JRUBY_VERSION > '1.6') or (defined? RUBY_ENGINE and RUBY_ENGINE[%r/^rbx/i])) ? 1 : 2
15
+ CALLER_INDEX = ((defined?(JRUBY_VERSION) && JRUBY_VERSION > '1.6' && JRUBY_VERSION < '9.0') ||
16
+ (defined?(RUBY_ENGINE) && RUBY_ENGINE[%r/^rbx/i])) ? 1 : 2
16
17
  # :startdoc:
17
18
 
18
- attr_accessor :logger, :level, :data, :time, :file, :line, :method
19
+ attr_accessor :logger, :level, :data, :time, :file, :line, :method_name
19
20
 
20
21
  # call-seq:
21
22
  # LogEvent.new( logger, level, [data], caller_tracing )
@@ -36,15 +37,15 @@ module Logging
36
37
  return if stack.nil?
37
38
 
38
39
  match = CALLER_RGXP.match(stack)
39
- self.file = match[1]
40
- self.line = Integer(match[2])
41
- self.method = match[3] unless match[3].nil?
40
+ self.file = match[1]
41
+ self.line = Integer(match[2])
42
+ self.method_name = match[3] unless match[3].nil?
42
43
 
43
44
  if (bp = ::Logging.basepath) && !bp.empty? && file.index(bp) == 0
44
45
  self.file = file.slice(bp.length + 1, file.length - bp.length)
45
46
  end
46
47
  else
47
- self.file = self.line = self.method = ''
48
+ self.file = self.line = self.method_name = ''
48
49
  end
49
50
  end
50
51
  end
@@ -24,8 +24,6 @@ module Logging
24
24
  #
25
25
  class Logger
26
26
 
27
- @mutex = Mutex.new # :nodoc:
28
-
29
27
  # Returns the root logger.
30
28
  def self.root
31
29
  ::Logging::Repository.instance[:root]
@@ -48,7 +46,10 @@ module Logging
48
46
  logger = repo[name]
49
47
  return logger unless logger.nil?
50
48
 
51
- @mutex.synchronize do
49
+ # Share the same mutex that's used by 'define_log_methods' because
50
+ # it iterates over the hash of loggers, and adding a new key to a hash
51
+ # while iterating over it produces an error.
52
+ ::Logging::Logger.mutex.synchronize do
52
53
  logger = repo[name]
53
54
  return logger unless logger.nil? # thread-safe double checking
54
55
 
@@ -118,6 +119,14 @@ module Logging
118
119
  code.join("\n")
119
120
  end
120
121
 
122
+ @mutex = ReentrantMutex.new
123
+
124
+ # Returns a global ReentrantMutex for use when creating Logger instances
125
+ # and/or updating log levels.
126
+ def self.mutex
127
+ @mutex
128
+ end
129
+
121
130
  attr_reader :name, :parent, :additive, :caller_tracing
122
131
 
123
132
  # call-seq:
@@ -411,7 +420,7 @@ module Logging
411
420
  def define_log_methods( force = false, code = nil )
412
421
  return if has_own_level? and !force
413
422
 
414
- ::Logging::Logger._reentrant_mutex.synchronize do
423
+ ::Logging::Logger.mutex.synchronize do
415
424
  ::Logging::Logger.define_log_methods(self)
416
425
  ::Logging::Repository.instance.children(name).each do |child|
417
426
  child.define_log_methods
@@ -423,12 +432,6 @@ module Logging
423
432
  # :stopdoc:
424
433
  public
425
434
 
426
- @reentrant_mutex = ReentrantMutex.new
427
-
428
- def self._reentrant_mutex
429
- @reentrant_mutex
430
- end
431
-
432
435
  # call-seq:
433
436
  # _meta_eval( code )
434
437
  #
@@ -511,6 +514,5 @@ module Logging
511
514
  end
512
515
  # :startdoc:
513
516
 
514
- end # Logger
515
- end # Logging
516
-
517
+ end
518
+ end
data/lib/logging/proxy.rb CHANGED
@@ -47,7 +47,7 @@ module Logging
47
47
 
48
48
  # All hail the magic of method missing. Here is where we are going to log
49
49
  # the method call and then forward to the proxied object. The return value
50
- # from the proxied objet method call is passed back.
50
+ # from the proxied object method call is passed back.
51
51
  #
52
52
  def method_missing( name, *args, &block )
53
53
  @logger << "#@leader#{name}(#{args.inspect[1..-2]})\n"
@@ -1,5 +1,5 @@
1
1
  module Logging
2
- VERSION = "2.2.1".freeze
2
+ VERSION = "2.3.1".freeze
3
3
 
4
4
  # Returns the version string for the library.
5
5
  def self.version
data/lib/logging.rb CHANGED
@@ -23,6 +23,8 @@ module Logging
23
23
  PATH = ::File.expand_path('../..', __FILE__) + ::File::SEPARATOR
24
24
  LEVELS = {}
25
25
  LNAMES = []
26
+ DEFAULT_CAUSE_DEPTH = 8
27
+
26
28
  module Plugins; end
27
29
  # :startdoc:
28
30
 
@@ -255,6 +257,9 @@ module Logging
255
257
  longest = 'off' if longest.length < 3
256
258
  module_eval "MAX_LEVEL_LENGTH = #{longest.length}", __FILE__, __LINE__
257
259
 
260
+ self.cause_depth = nil unless defined? @cause_depth
261
+ self.raise_errors = false unless defined? @raise_errors
262
+
258
263
  initialize_plugins
259
264
  levels.keys
260
265
  end
@@ -264,8 +269,8 @@ module Logging
264
269
  #
265
270
  # Defines the default _obj_format_ method to use when converting objects
266
271
  # into string representations for logging. _obj_format_ can be one of
267
- # <tt>:string</tt>, <tt>:inspect</tt>, or <tt>:yaml</tt>. These
268
- # formatting commands map to the following object methods
272
+ # <tt>:string</tt>, <tt>:inspect</tt>, <tt>:json</tt> or <tt>:yaml</tt>.
273
+ # These formatting commands map to the following object methods
269
274
  #
270
275
  # * :string => to_s
271
276
  # * :inspect => inspect
@@ -273,7 +278,7 @@ module Logging
273
278
  # * :json => MultiJson.encode(obj)
274
279
  #
275
280
  # An +ArgumentError+ is raised if anything other than +:string+,
276
- # +:inspect+, +:yaml+ is passed to this method.
281
+ # +:inspect+, +:json+ or +:yaml+ is passed to this method.
277
282
  #
278
283
  def format_as( f )
279
284
  f = f.intern if f.instance_of? String
@@ -336,6 +341,27 @@ module Logging
336
341
 
337
342
  attr_reader :utc_offset
338
343
 
344
+ # Set the default Exception#cause depth used when formatting Exceptions.
345
+ # This sets the maximum number of nested errors that will be formatted by
346
+ # the layouts before giving up. This is used to avoid extremely large
347
+ # outputs.
348
+ #
349
+ # Logging.cause_depth = nil # set to the DEFAULT_CAUSE_DEPTH
350
+ # Logging.cause_depth = 0 # do not show any exception causes
351
+ # Logging.cause_depth = 1024 # show up to 1024 causes
352
+ # Logging.cause_depth = -1 # results in the DEFAULT_CAUSE_DEPTH
353
+ #
354
+ def cause_depth=( value )
355
+ if value.nil?
356
+ @cause_depth = DEFAULT_CAUSE_DEPTH
357
+ else
358
+ value = Integer(value)
359
+ @cause_depth = value < 0 ? DEFAULT_CAUSE_DEPTH : value
360
+ end
361
+ end
362
+
363
+ attr_reader :cause_depth
364
+
339
365
  # Used to define a `basepath` that will be removed from filenames when
340
366
  # reporting tracing information for log events. Normally you would set this
341
367
  # to the root of your project:
@@ -465,6 +491,21 @@ module Logging
465
491
  io
466
492
  end
467
493
 
494
+ # Raise an exception when an error is encountered while logging, be it with
495
+ # a backing store, formatter, or anything else. You probably wouldn't want
496
+ # to enable this outside of test.
497
+ #
498
+ # Not that only one error will ever be raised per logging backend, as
499
+ # backends that raise errors on write will be set to :off.
500
+ def raise_errors=(boolean)
501
+ @raise_errors = boolean
502
+ end
503
+
504
+ # Whether or not we should raise errors when writing logs.
505
+ def raise_errors?
506
+ @raise_errors
507
+ end
508
+
468
509
  # :stopdoc:
469
510
  # Convert the given level into a canonical form - a lowercase string.
470
511
  def levelify( level )
@@ -493,7 +534,7 @@ module Logging
493
534
  # exception will be raised again.
494
535
  def log_internal_error( err )
495
536
  log_internal(-2) { err }
496
- raise err if Thread.abort_on_exception
537
+ raise err if ::Logging.raise_errors?
497
538
  end
498
539
 
499
540
  # Close all appenders
@@ -516,7 +557,8 @@ module Logging
516
557
  remove_instance_variable :@basepath if defined? @basepath
517
558
  remove_const :MAX_LEVEL_LENGTH if const_defined? :MAX_LEVEL_LENGTH
518
559
  remove_const :OBJ_FORMAT if const_defined? :OBJ_FORMAT
519
- self.utc_offset = nil
560
+ self.utc_offset = nil
561
+ self.cause_depth = nil
520
562
  self
521
563
  end
522
564
 
@@ -543,8 +585,7 @@ module Logging
543
585
  require libpath('logging/diagnostic_context')
544
586
 
545
587
  require libpath('logging/rails_compat')
546
- end # module Logging
547
-
588
+ end
548
589
 
549
590
  # This finalizer will close all the appenders that exist in the system.
550
591
  # This is needed for closing IO streams and connections to the syslog server
data/logging.gemspec CHANGED
@@ -1,45 +1,44 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: logging 2.1.0.48 ruby lib
2
+ # stub: logging 2.3.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "logging".freeze
6
- s.version = "2.1.0.48"
6
+ s.version = "2.3.0"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Tim Pease".freeze]
11
- s.date = "2017-01-08"
11
+ s.date = "2020-07-04"
12
12
  s.description = "**Logging** is a flexible logging library for use in Ruby programs based on the\ndesign of Java's log4j library. It features a hierarchical logging system,\ncustom level names, multiple output destinations per log event, custom\nformatting, and more.".freeze
13
13
  s.email = "tim.pease@gmail.com".freeze
14
14
  s.extra_rdoc_files = ["History.txt".freeze]
15
- s.files = [".gitignore".freeze, ".travis.yml".freeze, "History.txt".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "examples/appenders.rb".freeze, "examples/classes.rb".freeze, "examples/colorization.rb".freeze, "examples/custom_log_levels.rb".freeze, "examples/fork.rb".freeze, "examples/formatting.rb".freeze, "examples/hierarchies.rb".freeze, "examples/layouts.rb".freeze, "examples/lazy.rb".freeze, "examples/loggers.rb".freeze, "examples/mdc.rb".freeze, "examples/names.rb".freeze, "examples/rails4.rb".freeze, "examples/reusing_layouts.rb".freeze, "examples/rspec_integration.rb".freeze, "examples/simple.rb".freeze, "lib/logging.rb".freeze, "lib/logging/appender.rb".freeze, "lib/logging/appenders.rb".freeze, "lib/logging/appenders/buffering.rb".freeze, "lib/logging/appenders/console.rb".freeze, "lib/logging/appenders/file.rb".freeze, "lib/logging/appenders/io.rb".freeze, "lib/logging/appenders/rolling_file.rb".freeze, "lib/logging/appenders/string_io.rb".freeze, "lib/logging/appenders/syslog.rb".freeze, "lib/logging/color_scheme.rb".freeze, "lib/logging/diagnostic_context.rb".freeze, "lib/logging/filter.rb".freeze, "lib/logging/filters.rb".freeze, "lib/logging/filters/level.rb".freeze, "lib/logging/layout.rb".freeze, "lib/logging/layouts.rb".freeze, "lib/logging/layouts/basic.rb".freeze, "lib/logging/layouts/parseable.rb".freeze, "lib/logging/layouts/pattern.rb".freeze, "lib/logging/log_event.rb".freeze, "lib/logging/logger.rb".freeze, "lib/logging/proxy.rb".freeze, "lib/logging/rails_compat.rb".freeze, "lib/logging/repository.rb".freeze, "lib/logging/root_logger.rb".freeze, "lib/logging/utils.rb".freeze, "lib/logging/version.rb".freeze, "lib/rspec/logging_helper.rb".freeze, "lib/spec/logging_helper.rb".freeze, "logging.gemspec".freeze, "script/bootstrap".freeze, "script/console".freeze, "test/appenders/test_async_flushing.rb".freeze, "test/appenders/test_buffered_io.rb".freeze, "test/appenders/test_console.rb".freeze, "test/appenders/test_file.rb".freeze, "test/appenders/test_io.rb".freeze, "test/appenders/test_rolling_file.rb".freeze, "test/appenders/test_string_io.rb".freeze, "test/appenders/test_syslog.rb".freeze, "test/benchmark.rb".freeze, "test/layouts/test_basic.rb".freeze, "test/layouts/test_color_pattern.rb".freeze, "test/layouts/test_json.rb".freeze, "test/layouts/test_pattern.rb".freeze, "test/layouts/test_yaml.rb".freeze, "test/performance.rb".freeze, "test/setup.rb".freeze, "test/test_appender.rb".freeze, "test/test_color_scheme.rb".freeze, "test/test_filter.rb".freeze, "test/test_layout.rb".freeze, "test/test_log_event.rb".freeze, "test/test_logger.rb".freeze, "test/test_logging.rb".freeze, "test/test_mapped_diagnostic_context.rb".freeze, "test/test_nested_diagnostic_context.rb".freeze, "test/test_proxy.rb".freeze, "test/test_repository.rb".freeze, "test/test_root_logger.rb".freeze, "test/test_utils.rb".freeze]
15
+ s.files = [".gitignore".freeze, ".travis.yml".freeze, "History.txt".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "examples/appenders.rb".freeze, "examples/classes.rb".freeze, "examples/colorization.rb".freeze, "examples/custom_log_levels.rb".freeze, "examples/fork.rb".freeze, "examples/formatting.rb".freeze, "examples/hierarchies.rb".freeze, "examples/layouts.rb".freeze, "examples/lazy.rb".freeze, "examples/loggers.rb".freeze, "examples/mdc.rb".freeze, "examples/names.rb".freeze, "examples/rails4.rb".freeze, "examples/reusing_layouts.rb".freeze, "examples/rspec_integration.rb".freeze, "examples/simple.rb".freeze, "lib/logging.rb".freeze, "lib/logging/appender.rb".freeze, "lib/logging/appenders.rb".freeze, "lib/logging/appenders/buffering.rb".freeze, "lib/logging/appenders/console.rb".freeze, "lib/logging/appenders/file.rb".freeze, "lib/logging/appenders/io.rb".freeze, "lib/logging/appenders/rolling_file.rb".freeze, "lib/logging/appenders/string_io.rb".freeze, "lib/logging/appenders/syslog.rb".freeze, "lib/logging/color_scheme.rb".freeze, "lib/logging/diagnostic_context.rb".freeze, "lib/logging/filter.rb".freeze, "lib/logging/filters.rb".freeze, "lib/logging/filters/level.rb".freeze, "lib/logging/layout.rb".freeze, "lib/logging/layouts.rb".freeze, "lib/logging/layouts/basic.rb".freeze, "lib/logging/layouts/parseable.rb".freeze, "lib/logging/layouts/pattern.rb".freeze, "lib/logging/log_event.rb".freeze, "lib/logging/logger.rb".freeze, "lib/logging/proxy.rb".freeze, "lib/logging/rails_compat.rb".freeze, "lib/logging/repository.rb".freeze, "lib/logging/root_logger.rb".freeze, "lib/logging/utils.rb".freeze, "lib/logging/version.rb".freeze, "lib/rspec/logging_helper.rb".freeze, "lib/spec/logging_helper.rb".freeze, "logging.gemspec".freeze, "script/bootstrap".freeze, "script/console".freeze, "test/appenders/test_async_flushing.rb".freeze, "test/appenders/test_buffered_io.rb".freeze, "test/appenders/test_console.rb".freeze, "test/appenders/test_file.rb".freeze, "test/appenders/test_io.rb".freeze, "test/appenders/test_rolling_file.rb".freeze, "test/appenders/test_string_io.rb".freeze, "test/appenders/test_syslog.rb".freeze, "test/benchmark.rb".freeze, "test/layouts/test_basic.rb".freeze, "test/layouts/test_color_pattern.rb".freeze, "test/layouts/test_json.rb".freeze, "test/layouts/test_nested_exceptions.rb".freeze, "test/layouts/test_pattern.rb".freeze, "test/layouts/test_yaml.rb".freeze, "test/performance.rb".freeze, "test/setup.rb".freeze, "test/test_appender.rb".freeze, "test/test_color_scheme.rb".freeze, "test/test_filter.rb".freeze, "test/test_layout.rb".freeze, "test/test_log_event.rb".freeze, "test/test_logger.rb".freeze, "test/test_logging.rb".freeze, "test/test_mapped_diagnostic_context.rb".freeze, "test/test_nested_diagnostic_context.rb".freeze, "test/test_proxy.rb".freeze, "test/test_repository.rb".freeze, "test/test_root_logger.rb".freeze, "test/test_utils.rb".freeze]
16
16
  s.homepage = "http://rubygems.org/gems/logging".freeze
17
17
  s.rdoc_options = ["--main".freeze, "README.md".freeze]
18
- s.rubyforge_project = "logging".freeze
19
- s.rubygems_version = "2.5.2".freeze
18
+ s.rubygems_version = "3.0.1".freeze
20
19
  s.summary = "A flexible and extendable logging library for Ruby".freeze
21
- s.test_files = ["test/appenders/test_async_flushing.rb".freeze, "test/appenders/test_buffered_io.rb".freeze, "test/appenders/test_console.rb".freeze, "test/appenders/test_file.rb".freeze, "test/appenders/test_io.rb".freeze, "test/appenders/test_rolling_file.rb".freeze, "test/appenders/test_string_io.rb".freeze, "test/appenders/test_syslog.rb".freeze, "test/layouts/test_basic.rb".freeze, "test/layouts/test_color_pattern.rb".freeze, "test/layouts/test_json.rb".freeze, "test/layouts/test_pattern.rb".freeze, "test/layouts/test_yaml.rb".freeze, "test/test_appender.rb".freeze, "test/test_color_scheme.rb".freeze, "test/test_filter.rb".freeze, "test/test_layout.rb".freeze, "test/test_log_event.rb".freeze, "test/test_logger.rb".freeze, "test/test_logging.rb".freeze, "test/test_mapped_diagnostic_context.rb".freeze, "test/test_nested_diagnostic_context.rb".freeze, "test/test_proxy.rb".freeze, "test/test_repository.rb".freeze, "test/test_root_logger.rb".freeze, "test/test_utils.rb".freeze]
20
+ s.test_files = ["test/appenders/test_async_flushing.rb".freeze, "test/appenders/test_buffered_io.rb".freeze, "test/appenders/test_console.rb".freeze, "test/appenders/test_file.rb".freeze, "test/appenders/test_io.rb".freeze, "test/appenders/test_rolling_file.rb".freeze, "test/appenders/test_string_io.rb".freeze, "test/appenders/test_syslog.rb".freeze, "test/layouts/test_basic.rb".freeze, "test/layouts/test_color_pattern.rb".freeze, "test/layouts/test_json.rb".freeze, "test/layouts/test_nested_exceptions.rb".freeze, "test/layouts/test_pattern.rb".freeze, "test/layouts/test_yaml.rb".freeze, "test/test_appender.rb".freeze, "test/test_color_scheme.rb".freeze, "test/test_filter.rb".freeze, "test/test_layout.rb".freeze, "test/test_log_event.rb".freeze, "test/test_logger.rb".freeze, "test/test_logging.rb".freeze, "test/test_mapped_diagnostic_context.rb".freeze, "test/test_nested_diagnostic_context.rb".freeze, "test/test_proxy.rb".freeze, "test/test_repository.rb".freeze, "test/test_root_logger.rb".freeze, "test/test_utils.rb".freeze]
22
21
 
23
22
  if s.respond_to? :specification_version then
24
23
  s.specification_version = 4
25
24
 
26
25
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
26
  s.add_runtime_dependency(%q<little-plugger>.freeze, ["~> 1.1"])
28
- s.add_runtime_dependency(%q<multi_json>.freeze, ["~> 1.10"])
29
- s.add_development_dependency(%q<test-unit>.freeze, ["~> 3.1"])
27
+ s.add_runtime_dependency(%q<multi_json>.freeze, ["~> 1.14"])
28
+ s.add_development_dependency(%q<test-unit>.freeze, ["~> 3.3"])
30
29
  s.add_development_dependency(%q<bones-git>.freeze, ["~> 1.3"])
31
30
  s.add_development_dependency(%q<bones>.freeze, [">= 3.8.4"])
32
31
  else
33
32
  s.add_dependency(%q<little-plugger>.freeze, ["~> 1.1"])
34
- s.add_dependency(%q<multi_json>.freeze, ["~> 1.10"])
35
- s.add_dependency(%q<test-unit>.freeze, ["~> 3.1"])
33
+ s.add_dependency(%q<multi_json>.freeze, ["~> 1.14"])
34
+ s.add_dependency(%q<test-unit>.freeze, ["~> 3.3"])
36
35
  s.add_dependency(%q<bones-git>.freeze, ["~> 1.3"])
37
36
  s.add_dependency(%q<bones>.freeze, [">= 3.8.4"])
38
37
  end
39
38
  else
40
39
  s.add_dependency(%q<little-plugger>.freeze, ["~> 1.1"])
41
- s.add_dependency(%q<multi_json>.freeze, ["~> 1.10"])
42
- s.add_dependency(%q<test-unit>.freeze, ["~> 3.1"])
40
+ s.add_dependency(%q<multi_json>.freeze, ["~> 1.14"])
41
+ s.add_dependency(%q<test-unit>.freeze, ["~> 3.3"])
43
42
  s.add_dependency(%q<bones-git>.freeze, ["~> 1.3"])
44
43
  s.add_dependency(%q<bones>.freeze, [">= 3.8.4"])
45
44
  end
@@ -194,24 +194,22 @@ module TestAppenders
194
194
  assert_nil(readline)
195
195
  end
196
196
 
197
- if Object.const_defined?(:Encoding)
198
- def test_force_encoding
199
- a = 'ümlaut'
200
- b = 'hello ümlaut'.force_encoding('BINARY')
201
-
202
- event_a = Logging::LogEvent.new('TestLogger', @levels['info'], a, false)
203
- event_b = Logging::LogEvent.new('TestLogger', @levels['info'], b, false)
204
-
205
- @appender.append event_a
206
- @appender.append event_b
207
- assert_nil(readline)
208
-
209
- @appender.append event_a
210
- assert_equal " INFO TestLogger : #{a}\n", readline
211
- assert_equal " INFO TestLogger : #{b.force_encoding('UTF-8')}\n", readline
212
- assert_equal " INFO TestLogger : #{a}\n", readline
213
- assert_nil(readline)
214
- end
197
+ def test_force_encoding
198
+ a = 'ümlaut'
199
+ b = 'hello ümlaut'.force_encoding('BINARY')
200
+
201
+ event_a = Logging::LogEvent.new('TestLogger', @levels['info'], a, false)
202
+ event_b = Logging::LogEvent.new('TestLogger', @levels['info'], b, false)
203
+
204
+ @appender.append event_a
205
+ @appender.append event_b
206
+ assert_nil(readline)
207
+
208
+ @appender.append event_a
209
+ assert_equal " INFO TestLogger : #{a}\n", readline
210
+ assert_equal " INFO TestLogger : #{b.force_encoding('UTF-8')}\n", readline
211
+ assert_equal " INFO TestLogger : #{a}\n", readline
212
+ assert_nil(readline)
215
213
  end
216
214
 
217
215
  private