-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Replace logging with reflections Everyone logs differently, and everything is different for everyone. There for, give the power back to the people and return the job item that has all the valuable information. This will also allow people to extract metrics and such * Add reflections to README * Adds more reflections * Adds test coverage * Mandatory rubocop commit
- Loading branch information
Showing
36 changed files
with
631 additions
and
259 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
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,35 @@ | ||
# frozen_string_literal: true | ||
|
||
module SidekiqUniqueJobs | ||
# | ||
# Class Deprecation provides logging of deprecations | ||
# | ||
# @author Mikael Henriksson <mikael@mhenrixon.com> | ||
# | ||
class Deprecation | ||
def self.muted | ||
orig_val = Thread.current[:uniquejobs_mute_deprecations] | ||
Thread.current[:uniquejobs_mute_deprecations] = true | ||
yield | ||
ensure | ||
Thread.current[:uniquejobs_mute_deprecations] = orig_val | ||
end | ||
|
||
def self.muted? | ||
Thread.current[:uniquejobs_mute_deprecations] == true | ||
end | ||
|
||
def self.warn(msg) | ||
return if SidekiqUniqueJobs::Deprecation.muted? | ||
|
||
warn "DEPRECATION WARNING: #{msg}" | ||
end | ||
|
||
def self.warn_with_backtrace(msg) | ||
return if SidekiqUniqueJobs::Deprecation.muted? | ||
|
||
trace = "\n\nCALLED FROM:\n#{caller.join("\n")}" | ||
warn(msg + trace) | ||
end | ||
end | ||
end |
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
Oops, something went wrong.