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

Add Ability to Use Rails Initializer File #62

Closed
jfelchner opened this issue Jan 21, 2014 · 2 comments
Closed

Add Ability to Use Rails Initializer File #62

jfelchner opened this issue Jan 21, 2014 · 2 comments

Comments

@jfelchner
Copy link

I'd prefer to keep my configuration of whether Lograge is enabled inside chamber settings files and to use config/initializers/logger.rb to enable any of my logging setup.

Unfortunately it appears that the initializer hook that Lograge hooks into in its railtie happens before any initializers are run. So if I put:

# config/initializers/logger.rb
MyApp::Application.configure do
  config.lograge.enabled = Chamber.env.lograge.enabled?
end

as is suggested by the README, it doesn't work. And to be thorough it doesn't work even if I put true rather than the Chamber bit.

@gabebw
Copy link

gabebw commented Mar 13, 2014

I just ran into this. I'd prefer to move all lograge setup to its own file, rather than dumping it all into application.rb.

@jfelchner
Copy link
Author

No movement on this. Closing.

dburt added a commit to allori/lograge that referenced this issue May 28, 2015
Fixes issue roidrage#62.

This patch allows config.lograge.* to be set effectively in
config/initializers/* by delaying the Railtie until
after_initialize.

Because Railtie initializers run before those app initializers,
and the Lograge initializer loads the system only if
config.enabled is set at the time it runs, changing config.lograge
in config/initializers/* was previously ineffective.

A better solution yet would be to always assume enabled=true and
let enabling and disabling happen in the Gemfile or app
initializers using simply `require 'lograge'`.
dburt added a commit to allori/lograge that referenced this issue Jun 9, 2015
dburt added a commit to allori/lograge that referenced this issue Jun 10, 2015
Fixes issue roidrage#62.

This patch allows config.lograge.* to be set effectively in
config/initializers/* by delaying the Railtie until
after_initialize.

Because Railtie initializers run before those app initializers,
and the Lograge initializer loads the system only if
config.enabled is set at the time it runs, changing config.lograge
in config/initializers/* was previously ineffective.

A better solution yet would be to always assume enabled=true and
let enabling and disabling happen in the Gemfile or app
initializers using simply `require 'lograge'`.
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