Class: Ros::Console::Commands::ToggleLogger

Inherits:
Pry::ClassCommand
  • Object
show all
Defined in:
lib/ros/core/console.rb

Instance Method Summary collapse

Instance Method Details

#process(state = nil) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
# File 'lib/ros/core/console.rb', line 135

def process(state = nil)
  unless state.nil?
    return if (state == 'off' and ActiveRecord::Base.logger.nil?) or (state == 'on' and not ActiveRecord::Base.logger.nil?)
  end
  if ActiveRecord::Base.logger.nil?
    ActiveRecord::Base.logger = Rails.configuration.x.old_logger
  else
    Rails.configuration.x.old_logger = ActiveRecord::Base.logger
    ActiveRecord::Base.logger = nil
  end
end