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 new logger to subclass Rails logger #11

Merged
merged 7 commits into from Apr 12, 2016
Merged
Changes from 1 commit
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
Prev Previous commit
FIX: Add missing static function returning singleton logger
  • Loading branch information
alexcu committed Apr 11, 2016
commit c7d0d33e53745d3145ebf08e89c81f134afa62e2
13 changes: 13 additions & 0 deletions app/helpers/log_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@ class DoubtfireLogger < ActiveSupport::Logger
# Rails.logger initialises these as nil, so we will do the same
@@logger = DoubtfireLogger.new(nil, nil, nil)

#
# Singleton logger returned
#
def self.logger
@@logger
end

#
# Override fatal and error to puts to the console
# as well as log using Rails
#
def fatal(msg)
puts msg
super(msg)
Expand All @@ -25,6 +34,10 @@ def error(msg)
super(msg)
end
end

#
# Logger function returns the singleton logger
#
def logger
DoubtfireLogger.logger
end
Expand Down