Skip to content
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

Make automatic inclusion Mixin optional #18

Open
kikonen-fiksu opened this issue Feb 4, 2015 · 1 comment
Open

Make automatic inclusion Mixin optional #18

kikonen-fiksu opened this issue Feb 4, 2015 · 1 comment

Comments

@kikonen-fiksu
Copy link

I like a lot logging and also logging-rails due to that. However, I don't particularly like automagical inclusion of "logger" everywhere via ::Logging::Rails::Mixin done in https://github.com/TwP/logging-rails/blob/master/lib/logging/rails/railtie.rb.

While this is not problem with small project, with larger projects is starts to blur things a bit and creates hidden extra dependency.

So I would see beneficial to have option to turn off auto mixin, and have module, which would explicitly include "logger" method in the context.

For example,

class Foobar
  include Logging::Log
end
@sshaw
Copy link

sshaw commented May 10, 2015

I agree, out the box logging-rails turns on the firehose. It should only add the logger to things that Rails does by default. This does not include Rails.cache and ActiveSupport::Dependencies.logger.

It also (somehow) adds the logger to seemingly random classes at startup.

Here's how logging configures my app:

root  ............................................  *debug      -T
- <Appenders::Stdout:0x3fcb793bf02c name="stdout">
- <Appenders::RollingFile:0x3fcb793beba4 name="file">
  ActionController::Base  ........................   debug  +A  -T
  ActionMailer::Base  ............................   debug  +A  -T
  ActiveRecord::Base  ............................   debug  +A  -T
  ActiveRecord::Relation  ........................   debug  +A  -T
  ActiveSupport::Cache::FileStore  ...............   debug  +A  -T
  ActiveSupport::Dependencies  ...................   debug  +A  -T
  ActiveSupport::OrderedOptions  .................   debug  +A  -T
  Category  ......................................   debug  +A  -T
  Country  .......................................   debug  +A  -T
  Logging  .......................................    *off  -A  -T
  Rails  .........................................   debug  +A  -T

Note ActiveSupport::OrderedOptions, Country, and Category. The latter two are 2 of many models, not sure why they're shown.

ActiveSupport::OrderedOptions is random, and note that the messages it produces are confusing:

[2015-05-10 15:18:53] INFO  ActiveSupport::OrderedOptions : Served asset /ember-1.0.0.min.js - 304 Not Modified (3ms)

That comes from Sprockets, not OrderedOptions.

Of course logging for these classes can be turned off, but I why even turn them on?

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

2 participants