rails_semantic_logger
rails_semantic_logger copied to clipboard
Extracting Sidekiq logic out of rails_semantic_logger
Hello @reidmorrison 👋
I've been recently working in a non-rails project that makes use of Sidekiq and I'd love to integrate SemanticLogger there. From what I can see however, it seems that there's quite a bit of logic to add proper support for Sidekiq - and it's all within rails_semantic_logger codebase.
What do you think of extracting the Sidekiq related code up to semantic_logger or, perhaps, to a new dedicated gem (e.g.: sidekiq_semantic_logger)? Regardless of where the code might move, rails_semantic_logger could still automatically require it and patch Sidekiq logger so I don't think this would be a breaking change - plus it could make development towards Sidekiq development a bit easier to maintain.
From what I see there wouldn't be many changes involved, only:
- Move these to their new destination (
semantic_loggerorsidekiq_semantic_logger):lib/rails_semantic_logger/extensions/sidekiq/sidekiq.rblib/rails_semantic_logger/sidekiq/defaults.rblib/rails_semantic_logger/sidekiq/job_logger.rblib/rails_semantic_logger/sidekiq/loggable.rb- the whole sidekiq code block in the rails engine to a new patcher file, e.g.:
module SidekiqSemanticLogger module Patcher def self.patch! ::Sidekiq.configure_client do |config| config.logger = ::SemanticLogger[::Sidekiq] # ... and so on - Update the rails engine to load the new patcher file and patch Sidekiq logger if the
::Sidekiqconstant is defined.
Let me know your thoughts! I can definitely help if that sounds like a welcome change 😄