reidmorrison / rails_semantic_logger

Rails Semantic Logger replaces the Rails default logger with Semantic Logger
https://logger.rocketjob.io/rails
Apache License 2.0
330 stars 117 forks source link

Add proper ActiveJob events subscription #87

Closed prikha closed 5 years ago

prikha commented 5 years ago

Issue # (if available)

Right now when I add rails_semantic_logger to an application with active_job I have rather useless lines in the log. However this could/should be improved. Events have structured payload which comes handy in the logs.

https://github.com/rails/rails/blob/master/activejob/lib/active_job/logging.rb

One probably would want to refuse native job adapter logging when this one is setup.

Description of changes

Overriding ActiveJob::Logging::LogSubscriber and re-subscribing to the *.active_job events does the trick.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

prikha commented 5 years ago

@reidmorrison 👋

Can you please check it out. Since we have a place for all the Rails-related integrations - I would like to add this ActiveJob thing it helps a lot in terms of transparency. And it allows not to deal with any internal logging of any available background processing implementation.

reidmorrison commented 5 years ago

Well done extracting all that valuable semantic information. Thank you !!