rails_semantic_logger 4.1.2 → 4.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a7c538cec8c358c81939c54ff8db6ce47e1ca46
4
- data.tar.gz: 9eeb2407f8157458f9dcbf2db5577a06140df5a8
3
+ metadata.gz: 607046851ee5bfb0335e577fbb87f9c3ae6ab93f
4
+ data.tar.gz: 3375c64b102e5461ba50412a3495c898524f63df
5
5
  SHA512:
6
- metadata.gz: f2b620e2153ed6201c4c84434fe8e94d41fa1635dd414cd23b669b4258b5a4fc2cefddce129ab415976587ef9abdd53e6594d97c8e07f98be8fd2659d71fc4a2
7
- data.tar.gz: 3aaeb1cd8136eeb906051a41ad45ce2d709bb46cf3c458f4fb520c9548f3de82898bf67eae8a32992b12b13de650b0d97ecbb9872311ee150640a66a6c5fc32d
6
+ metadata.gz: 44f58b19256318c9fa3acb07fb08a862000acf7e15bfe27dda9fdb29052627da9c484da91fbefde02840cacdd8d7ec7556189a5297c898db39b9fde19fd1d491
7
+ data.tar.gz: 860b06c8b1083e12befe6b074e1a8d0281186fa30a3f02f5342465bd44c50905a3703f90071b376a04db8c01b897d6273ab6b4fac4d81a0d6115cbd6ca5b5322
@@ -96,6 +96,13 @@ module RailsSemanticLogger
96
96
  # Instead, supply a Hash to config.log_tags
97
97
  config.rails_semantic_logger.named_tags = nil
98
98
 
99
+ # Add a filter to the file logger [Regexp|Proc]
100
+ # RegExp: Only include log messages where the class name matches the supplied
101
+ # regular expression. All other messages will be ignored.
102
+ # Proc: Only include log messages where the supplied Proc returns true.
103
+ # The Proc must return true or false.
104
+ config.rails_semantic_logger.filter = nil
105
+
99
106
  # Initialize SemanticLogger. In a Rails environment it will automatically
100
107
  # insert itself above the configured rails logger to add support for its
101
108
  # additional features
@@ -118,9 +125,9 @@ module RailsSemanticLogger
118
125
 
119
126
  # Add the log file to the list of appenders
120
127
  # Use the colorized formatter if Rails colorized logs are enabled
121
- ap_options = config.rails_semantic_logger.ap_options
122
- formatter = config.rails_semantic_logger.format
123
- formatter = SemanticLogger::Formatters::Color.new(ap: ap_options) if (formatter == :default) && (config.colorize_logging != false)
128
+ ap_options = config.rails_semantic_logger.ap_options
129
+ formatter = config.rails_semantic_logger.format
130
+ formatter = {color: {ap: ap_options}} if (formatter == :default) && (config.colorize_logging != false)
124
131
 
125
132
  # Set internal logger to log to file only, in case another appender experiences errors during writes
126
133
  appender = SemanticLogger::Appender::File.new(file_name: path, level: config.log_level, formatter: formatter)
@@ -128,8 +135,12 @@ module RailsSemanticLogger
128
135
  SemanticLogger::Processor.logger = appender
129
136
 
130
137
  # Check for previous file or stdout loggers
131
- SemanticLogger.appenders.each { |appender| appender.formatter = formatter if appender.is_a?(SemanticLogger::Appender::File) }
132
- SemanticLogger.add_appender(file_name: path, formatter: formatter)
138
+ if SemanticLogger::VERSION.to_f >= 4.2
139
+ SemanticLogger.appenders.each { |appender| appender.formatter = formatter if appender.is_a?(SemanticLogger::Appender::File) }
140
+ elsif config.colorize_logging == false
141
+ SemanticLogger.appenders.each { |appender| appender.formatter = SemanticLogger::Formatters::Default.new if appender.is_a?(SemanticLogger::Appender::File) }
142
+ end
143
+ SemanticLogger.add_appender(file_name: path, formatter: formatter, filter: config.rails_semantic_logger.filter)
133
144
  end
134
145
 
135
146
  SemanticLogger[Rails]
@@ -242,7 +253,7 @@ module RailsSemanticLogger
242
253
  end
243
254
  end
244
255
 
245
- # Before any initializers run, but after the gems have been loaded
256
+ # After any initializers run, but after the gems have been loaded
246
257
  config.after_initialize do
247
258
  # Replace the Bugsnag logger
248
259
  Bugsnag.configure { |config| config.logger = SemanticLogger[Bugsnag] } if defined?(Bugsnag)
@@ -1,3 +1,3 @@
1
1
  module RailsSemanticLogger #:nodoc
2
- VERSION = '4.1.2'
2
+ VERSION = '4.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_semantic_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.2
4
+ version: 4.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-25 00:00:00.000000000 Z
11
+ date: 2017-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails