jeremyevans/roda-sequel-stack

the `logger` is initialized only in development mode

Closed this issue · 4 comments

Unreloader = Rack::Unreloader.new(subclasses: %w'Roda Sequel::Model', logger: logger, reload: dev){App}

In the non development mode logger doesn't exist. Isn't it?

Correct, but the :logger option accepts nil as a valid value for no logger, so this is not a problem.

@jeremyevans
I mean logger variable is missing. So it's not nil.
If the environment is not development, logger variable is not defined. And it will exception.

Above this code, we have:

if dev
  require 'logger'
  logger = Logger.new($stdout)
end

In Ruby, if dev is false, then logger is nil.

If you are actually getting an exception raised, please post the backtrace.

Thanks @jeremyevans
This is new knowledge for me :)