-
-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
212 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# These are supported funding model platforms | ||
|
||
github: reidmorrison |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "appraisal" | ||
gem "puma" | ||
gem "active_model_serializers" | ||
gem "amazing_print" | ||
gem "minitest" | ||
gem "minitest-rails" | ||
gem "rake" | ||
gem "sprockets", "< 4.0" | ||
gem "rails", "~> 7.1.0" | ||
gem "sidekiq", "~> 7.3.0" | ||
gem "sqlite3", "~> 1.4" | ||
gem "rubocop" | ||
|
||
gemspec path: "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
module RailsSemanticLogger | ||
module Sidekiq | ||
module Defaults | ||
# Prevent exception logging during standard error handling since the Job Logger below already logs the exception. | ||
ERROR_HANDLER = | ||
if ::Sidekiq::VERSION.to_f < 7.1 || | ||
(::Sidekiq::VERSION.to_f == 7.1 && ::Sidekiq::VERSION.split(".").last.to_i < 6) | ||
lambda do |_ex, ctx| | ||
unless ctx.empty? | ||
job_hash = ctx[:job] || {} | ||
klass = job_hash["display_class"] || job_hash["wrapped"] || job_hash["class"] | ||
logger = klass ? SemanticLogger[klass] : Sidekiq.logger | ||
ctx[:context] ? logger.warn(ctx[:context], ctx) : logger.warn(ctx) | ||
end | ||
end | ||
else | ||
lambda do |_ex, ctx, _default_configuration| | ||
unless ctx.empty? | ||
job_hash = ctx[:job] || {} | ||
klass = job_hash["display_class"] || job_hash["wrapped"] || job_hash["class"] | ||
logger = klass ? SemanticLogger[klass] : Sidekiq.logger | ||
ctx[:context] ? logger.warn(ctx[:context], ctx) : logger.warn(ctx) | ||
end | ||
end | ||
end | ||
|
||
# Returns the default logger after removing from the supplied list. | ||
# Returns [nil] when the default logger was not present. | ||
def self.delete_default_error_handler(error_handlers) | ||
return error_handlers.delete(::Sidekiq::Config::ERROR_HANDLER) if defined?(::Sidekiq::Config::ERROR_HANDLER) | ||
return error_handlers.delete(::Sidekiq::DEFAULT_ERROR_HANDLER) if defined?(::Sidekiq::DEFAULT_ERROR_HANDLER) | ||
|
||
return unless defined?(::Sidekiq::ExceptionHandler) | ||
|
||
existing = error_handlers.find { |handler| handler.is_a?(::Sidekiq::ExceptionHandler::Logger) } | ||
error_handlers.delete(existing) if existing | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.