Skip to content

Extracting Sidekiq logic out of rails_semantic_logger #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Drowze opened this issue Feb 18, 2025 · 0 comments
Open

Extracting Sidekiq logic out of rails_semantic_logger #260

Drowze opened this issue Feb 18, 2025 · 0 comments

Comments

@Drowze
Copy link

Drowze commented Feb 18, 2025

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:

  1. Move these to their new destination (semantic_logger or sidekiq_semantic_logger):
    • lib/rails_semantic_logger/extensions/sidekiq/sidekiq.rb
    • lib/rails_semantic_logger/sidekiq/defaults.rb
    • lib/rails_semantic_logger/sidekiq/job_logger.rb
    • lib/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
  2. Update the rails engine to load the new patcher file and patch Sidekiq logger if the ::Sidekiq constant is defined.

Let me know your thoughts! I can definitely help if that sounds like a welcome change 😄

@Drowze Drowze changed the title Extracting Sidekiq out of rails_semantic_logger Extracting Sidekiq logic out of rails_semantic_logger Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant