semantic_logger 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/FUTURE.rb CHANGED
@@ -1,4 +1,10 @@
1
1
 
2
+ # Replace these log subscribers
3
+
4
+ ActiveSupport::LogSubscriber.log_subscribers
5
+
6
+
7
+
2
8
  # # Switch to slf4j as the underlying implementation
3
9
  # Clarity::Logger.impl = slf4j
4
10
  #
@@ -69,7 +69,7 @@ module SemanticLogger
69
69
  # Flush all pending logs to disk.
70
70
  # Waits for all sent documents to be writted to disk
71
71
  def flush
72
- @logger.flush
72
+ @logger.flush if @logger.respond_to?(:flush)
73
73
  end
74
74
 
75
75
  end
@@ -56,12 +56,16 @@ module SemanticLogger #:nodoc:
56
56
 
57
57
  # Replace the default Rails loggers
58
58
  Rails.logger = config.logger = SemanticLogger::Logger.new(Rails)
59
- if defined?(ActiveRecord)
59
+ if defined?(ActiveRecord::Base)
60
60
  ActiveRecord::Base.logger = SemanticLogger::Logger.new(ActiveRecord)
61
61
  end
62
- if defined?(ActionController)
62
+ if defined?(ActionController::Base)
63
63
  ActionController::Base.logger = SemanticLogger::Logger.new(ActionController)
64
64
  end
65
+ if defined?(ActiveResource::Base)
66
+ ActiveResource::Base.logger = SemanticLogger::Logger.new(ActiveResource)
67
+ end
68
+
65
69
  SemanticLogger::Logger.logger.info "SemanticLogger initialized"
66
70
  end
67
71
 
@@ -1,3 +1,3 @@
1
1
  module SemanticLogger #:nodoc
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 1
9
- version: 0.3.1
8
+ - 2
9
+ version: 0.3.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Reid Morrison
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-08-21 00:00:00 -04:00
17
+ date: 2012-08-30 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -44,7 +44,6 @@ files:
44
44
  - lib/semantic_logger/appender/logger.rb
45
45
  - lib/semantic_logger/appender/mongodb.rb
46
46
  - lib/semantic_logger/logger.rb
47
- - lib/semantic_logger/rails.rb
48
47
  - lib/semantic_logger/railtie.rb
49
48
  - lib/semantic_logger/version.rb
50
49
  - lib/semantic_logger.rb
@@ -1,48 +0,0 @@
1
- #
2
- # IGNORE THIS FILE
3
- #
4
-
5
- module SemanticLogger
6
- module Appender
7
- # Logger appender
8
- #
9
- # Maps the SemanticLogger API's to the Rails log, or Ruby Logger
10
- #
11
- # The following changes are made:
12
- # The klass_name is prefixed on all log entries if available.
13
- #
14
- # Note: For performance, the original Rails Logger or Ruby Logger is returned,
15
- # with that instance populated with the new API's to support SymanticLogger
16
- #
17
- # Installation:
18
- # Rails.logger = SemanticLogger::LoggerAppender.new(Rails.logger)
19
- # Also works with the Ruby Logger
20
- # logger = Logger.new ....
21
- # Rails.log = LoggerAppender.new()
22
- #
23
- # ActiveResource::BufferedLogger
24
- # ...
25
- #
26
- # Append to the default Rails log
27
- #
28
- # Note: The Rails log must be initialized prior to this Appender being started
29
- # Or, the original Rails log must be passed into the initializer
30
- #
31
- class Logger
32
- @@level_map = {:trace => :debug, :debug=>:debug, :info=>:info, :warn=>:warn, :error=>:error}
33
-
34
- # These are a problem at the appender level, need to move to API
35
- # Not consistent with the other appenders levels
36
- def level
37
- @logger.level
38
- end
39
-
40
- def level=(new_level)
41
- @logger.level = new_level
42
- end
43
-
44
-
45
-
46
- end
47
- end
48
- end