semantic_logger 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/bson_client.log ADDED
File without changes
@@ -265,14 +265,16 @@ module SemanticLogger
265
265
  # Internal method to return the log level as an internal index
266
266
  # Also supports mapping the ::Logger levels to SemanticLogger levels
267
267
  def self.map_level_to_index(level)
268
- index = if level.is_a?(Integer)
268
+ index = if level.is_a?(Integer) && defined?(::Logger::Severity)
269
269
  # Mapping of Rails and Ruby Logger levels to SemanticLogger levels
270
270
  @@map_levels ||= begin
271
271
  levels = []
272
272
  ::Logger::Severity.constants.each do |constant|
273
273
  levels[::Logger::Severity.const_get(constant)] = LEVELS.find_index(constant.downcase.to_sym) || LEVELS.find_index(:error)
274
274
  end
275
- end [level] if defined?(::Logger::Severity)
275
+ levels
276
+ end
277
+ @@map_levels[level]
276
278
  elsif level.is_a?(String)
277
279
  level = level.downcase.to_sym
278
280
  LEVELS.index(level)
@@ -1,3 +1,3 @@
1
1
  module SemanticLogger #:nodoc
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
data/test/logger_test.rb CHANGED
@@ -70,6 +70,26 @@ class LoggerTest < Test::Unit::TestCase
70
70
  end
71
71
  end
72
72
 
73
+ context "Ruby Logger" do
74
+
75
+ # Ensure that any log level can be logged
76
+ Logger::Severity.constants.each do |level|
77
+ should "log Ruby logger #{level} info" do
78
+ @logger.level = Logger::Severity.const_get(level)
79
+ #assert_equal level.downcase.to_sym, @logger.level
80
+ if level == 'UNKNOWN'
81
+ assert_equal Logger::Severity.const_get('ERROR')+1, @logger.send(:level_index)
82
+ else
83
+ assert_equal Logger::Severity.const_get(level)+1, @logger.send(:level_index)
84
+ end
85
+ # @logger.send(level, 'hello world', @hash) { "Calculations" }
86
+ # SemanticLogger::Logger.flush
87
+ # assert_match /\d+-\d+-\d+ \d+:\d+:\d+.\d+ \w \[\d+:.+\] LoggerTest -- hello world -- Calculations -- #{@hash_str}/, @mock_logger.message
88
+ end
89
+ end
90
+ end
91
+
92
+
73
93
  end
74
94
  end
75
95
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 1
9
- version: 0.6.1
8
+ - 2
9
+ version: 0.6.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Reid Morrison
@@ -51,6 +51,7 @@ extensions: []
51
51
  extra_rdoc_files: []
52
52
 
53
53
  files:
54
+ - bson_client.log
54
55
  - FUTURE.rb
55
56
  - init.txt
56
57
  - lib/semantic_logger/appender/file.rb