rails_semantic_logger 4.6.0 → 4.10.0

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
  SHA256:
3
- metadata.gz: 453828593f931f4f57c75337f47ae552a77be8597ef49bb838a4c4fa032f04a7
4
- data.tar.gz: 1a1d9354c9368fb9e14703a422e08b9f5274734b281789d220df793af678ae8b
3
+ metadata.gz: 8e01fc2392ba9faf266764afc12136a13800e8d90eec24c7617c5db4ced6e272
4
+ data.tar.gz: f0685d627c3891d0cd3b105a1ced10f846bb91e7dd695cf329ac775bce9c6c72
5
5
  SHA512:
6
- metadata.gz: 69d52f1889d27b459313785c5e98f88e90d8b5367d6c5cca1e10d82d4e7a171095b9cfeae0ceae63b7faaf826e2ef71df36bbc213c7c592a9ceabef75b06e6c8
7
- data.tar.gz: a216178a0be935a7c15710d0921fdee562bbe0c46bb5bbd5f2cb5250ad097acdb6142dfd1ec68fe7524afff59d4fc44d2b48d8ea3ad3190f54f539582c65af5f
6
+ metadata.gz: 3658cc65b3bfe4c6e1e6f0a5df42b9f66f033250de1fce1e2284e4727096f46e9a3314956198f6cd71299aad7d0708455ce4ecb4744328c0b8ecb8727487f59e
7
+ data.tar.gz: 6b1dbedd0208a4055156fb6a12c8b06847fdbfab4d2b907252fbaed97ef33474ec50709ad7a6c4a056292c19c61c183c8a32737de16ec7fe59a2bd830913522b
@@ -55,16 +55,16 @@ module RailsSemanticLogger
55
55
  formatter = {color: {ap: ap_options}} if (formatter == :default) && (config.colorize_logging != false)
56
56
 
57
57
  # Set internal logger to log to file only, in case another appender experiences errors during writes
58
- appender = SemanticLogger::Appender::File.new(
59
- file_name: path,
60
- level: config.log_level,
61
- formatter: formatter
62
- )
58
+ appender = SemanticLogger::Appender::File.new(path, formatter: formatter)
63
59
  appender.name = "SemanticLogger"
64
60
  SemanticLogger::Processor.logger = appender
65
61
 
66
62
  # Check for previous file or stdout loggers
67
- SemanticLogger.appenders.each { |app| app.formatter = formatter if app.is_a?(SemanticLogger::Appender::File) }
63
+ SemanticLogger.appenders.each do |app|
64
+ next unless app.is_a?(SemanticLogger::Appender::File) || app.is_a?(SemanticLogger::Appender::IO)
65
+
66
+ app.formatter = formatter
67
+ end
68
68
  SemanticLogger.add_appender(file_name: path, formatter: formatter, filter: config.rails_semantic_logger.filter)
69
69
  end
70
70
 
@@ -73,8 +73,8 @@ module RailsSemanticLogger
73
73
  # If not able to log to file, log to standard error with warning level only
74
74
  SemanticLogger.default_level = :warn
75
75
 
76
- SemanticLogger::Processor.logger = SemanticLogger::Appender::File.new(io: STDERR)
77
- SemanticLogger.add_appender(io: STDERR)
76
+ SemanticLogger::Processor.logger = SemanticLogger::Appender::IO.new($stderr)
77
+ SemanticLogger.add_appender(io: $stderr)
78
78
 
79
79
  logger = SemanticLogger[Rails]
80
80
  logger.warn(
@@ -123,6 +123,9 @@ module RailsSemanticLogger
123
123
 
124
124
  # Replace the Bugsnag logger
125
125
  Bugsnag.configure { |config| config.logger = SemanticLogger[Bugsnag] } if defined?(Bugsnag)
126
+
127
+ # Set the IOStreams PGP logger
128
+ IOStreams::Pgp.logger = SemanticLogger["IOStreams::Pgp"] if defined?(IOStreams)
126
129
  end
127
130
 
128
131
  # After any initializers run, but after the gems have been loaded
@@ -218,7 +221,10 @@ module RailsSemanticLogger
218
221
  console do |_app|
219
222
  # Don't use a background thread for logging
220
223
  SemanticLogger.sync!
221
- SemanticLogger.add_appender(io: STDERR, formatter: :color)
224
+ # Add a stderr logger when running inside a Rails console unless one has already been added.
225
+ if config.rails_semantic_logger.console_logger && !SemanticLogger.appenders.console_output?
226
+ SemanticLogger.add_appender(io: STDERR, formatter: :color)
227
+ end
222
228
 
223
229
  # Include method names on log entries in the console
224
230
  SemanticLogger.backtrace_level = SemanticLogger.default_level
@@ -1,4 +1,4 @@
1
- ActionCable::Connection::TaggedLoggerProxy
1
+ require "action_cable/connection/tagged_logger_proxy"
2
2
 
3
3
  module ActionCable
4
4
  module Connection
@@ -1,7 +1,9 @@
1
1
  # Log actual exceptions, not a string representation
2
- ActionController::Live
2
+ require "action_controller"
3
+
3
4
  module ActionController
4
5
  module Live
6
+ undef_method :log_error
5
7
  def log_error(exception)
6
8
  logger.fatal(exception)
7
9
  end
@@ -1,9 +1,11 @@
1
1
  # Log actual exceptions, not a string representation
2
- ActionDispatch::DebugExceptions
2
+ require "action_dispatch"
3
+
3
4
  module ActionDispatch
4
5
  class DebugExceptions
5
6
  private
6
7
 
8
+ undef_method :log_error
7
9
  def log_error(_request, wrapper)
8
10
  ActiveSupport::Deprecation.silence do
9
11
  ActionController::Base.logger.fatal(wrapper.exception)
@@ -1,11 +1,12 @@
1
1
  # Log actual exceptions, not a string representation
2
- ActionView::StreamingTemplateRenderer
2
+ require "action_view/renderer/streaming_template_renderer"
3
3
 
4
4
  module ActionView
5
5
  class StreamingTemplateRenderer
6
6
  class Body
7
7
  private
8
8
 
9
+ undef_method :log_error
9
10
  def log_error(exception)
10
11
  ActionView::Base.logger.fatal(exception)
11
12
  end
@@ -7,6 +7,7 @@ module ActiveJob
7
7
 
8
8
  private
9
9
 
10
+ undef_method :tag_logger
10
11
  def tag_logger(*tags, &block)
11
12
  logger.tagged(*tags, &block)
12
13
  end
@@ -3,6 +3,10 @@ require "active_support/logger"
3
3
  module ActiveSupport
4
4
  # More hacks to try and stop Rails from being it's own worst enemy.
5
5
  class Logger
6
+ class << self
7
+ undef :logger_outputs_to?, :broadcast
8
+ end
9
+
6
10
  # Prevent Console from trying to merge loggers
7
11
  def self.logger_outputs_to?(*args)
8
12
  true
@@ -1,13 +1,15 @@
1
1
  # Patch the Rails::Server log_to_stdout so that it logs via SemanticLogger
2
- Rails::Server
2
+ require "rails"
3
+
3
4
  module Rails
4
5
  class Server
5
6
  private
6
-
7
+
8
+ undef_method :log_to_stdout
7
9
  def log_to_stdout
8
10
  wrapped_app # touch the app so the logger is set up
9
11
 
10
- SemanticLogger.add_appender(io: $stdout, formatter: :color)
12
+ SemanticLogger.add_appender(io: $stdout, formatter: :color) unless SemanticLogger.appenders.console_output?
11
13
  end
12
14
  end
13
15
  end
@@ -40,7 +40,7 @@ module RailsSemanticLogger
40
40
  # When Semantic Logger fails to log to an appender it logs the error to an
41
41
  # internal logger, which by default writes to STDERR.
42
42
  # Example, change the default internal logger to log to stdout:
43
- # SemanticLogger::Processor.logger = SemanticLogger::Appender::File.new(io: STDOUT, level: :warn)
43
+ # SemanticLogger::Processor.logger = SemanticLogger::Appender::IO.new($stdout, level: :warn)
44
44
  #
45
45
  # config.rails_semantic_logger.add_file_appender = true
46
46
  #
@@ -48,6 +48,10 @@ module RailsSemanticLogger
48
48
  #
49
49
  # config.rails_semantic_logger.quiet_assets = false
50
50
  #
51
+ # * Disable automatic logging to stderr when running a Rails console.
52
+ #
53
+ # config.rails_semantic_logger.console_logger = false
54
+ #
51
55
  # * Override the output format for the primary Rails log file.
52
56
  #
53
57
  # Valid options:
@@ -98,7 +102,7 @@ module RailsSemanticLogger
98
102
  # config.rails_semantic_logger.named_tags = nil
99
103
  class Options
100
104
  attr_accessor :semantic, :started, :processing, :rendered, :ap_options, :add_file_appender,
101
- :quiet_assets, :format, :named_tags, :filter
105
+ :quiet_assets, :format, :named_tags, :filter, :console_logger
102
106
 
103
107
  # Setup default values
104
108
  def initialize
@@ -112,6 +116,7 @@ module RailsSemanticLogger
112
116
  @format = :default
113
117
  @named_tags = nil
114
118
  @filter = nil
119
+ @console_logger = true
115
120
  end
116
121
  end
117
122
  end
@@ -1,3 +1,3 @@
1
1
  module RailsSemanticLogger
2
- VERSION = "4.6.0".freeze
2
+ VERSION = "4.10.0".freeze
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.6.0
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-17 00:00:00.000000000 Z
11
+ date: 2022-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '3.2'
33
+ version: '5.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '3.2'
40
+ version: '5.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: semantic_logger
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '4.8'
47
+ version: '4.9'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '4.8'
54
+ version: '4.9'
55
55
  description:
56
56
  email:
57
57
  executables: []
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.2.15
104
+ rubygems_version: 3.3.3
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Feature rich logging framework that replaces the Rails logger.