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

Fix scoping error for logger in Rails 4 #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/le.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def self.new(token, local=false, debug_level = Logger::DEBUG)
self.checkParams(token)

host = Le::Host.new(token, local)
logger = Logger.new(host)
logger = ActiveSupport::Logger.new(host)
logger.level = debug_level

if host.respond_to?(:formatter)
Expand Down
6 changes: 3 additions & 3 deletions lib/le/host/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class HTTP

def initialize(token, local)
if defined?(Rails)
@logger_console = Logger.new("log/#{Rails.env}.log")
@logger_console = ActiveSupport::Logger.new("log/#{Rails.env}.log")
else
@logger_console = Logger.new(STDOUT)
@logger_console = ActiveSupport::Logger.new(STDOUT)
end
@token = token
@local = local
Expand All @@ -24,7 +24,7 @@ def initialize(token, local)

def write(message)
if @local then
@logger_console.add(Logger::Severity::UNKNOWN,message)
@logger_console.add(ActiveSupport::Logger::Severity::UNKNOWN,message)
end

@queue << "#{@token}#{message}\n"
Expand Down