class LogToolbox::LogController
Public Instance Methods
change_level()
click to toggle source
# File lib/log_toolbox/log_controller.rb, line 10 def change_level log_info("Log level was changed to #{level_param}") Rails.logger.level = Logger.const_get(level_param.upcase) render json: { message: "Your application log level was changed to #{rails_logger}", log_options: options, log_levels: levels } end
test()
click to toggle source
# File lib/log_toolbox/log_controller.rb, line 21 def test log_debug('Log level DEBUG') log_info('Log level INFO') log_warn('Log level WARN') log_error('Log level ERR') log_critical('Log level CRIT') render json: { message: "Your application log level is #{rails_logger}", log_options: options, log_levels: levels } end
Private Instance Methods
level_param()
click to toggle source
# File lib/log_toolbox/log_controller.rb, line 49 def level_param params.require(:level) end
levels()
click to toggle source
# File lib/log_toolbox/log_controller.rb, line 41 def levels { DEBUG: 0, INFO: 1, WARN: 2, ERROR: 3, FATAL: 4 } end
options()
click to toggle source
# File lib/log_toolbox/log_controller.rb, line 37 def options %w[DEBUG INFO WARN ERROR FATAL] end
rails_logger()
click to toggle source
# File lib/log_toolbox/log_controller.rb, line 45 def rails_logger Rails.logger.level end