Sha256: 97a2a5486a0d80951d9031d8556e99c75e97e6edd1ff1bd1750082680ae76b25
Contents?: true
Size: 737 Bytes
Versions: 1
Compression:
Stored size: 737 Bytes
Contents
module Jlog class AjaxController < ActionController::Metal include ActionController::Rendering def append messages = params[:message] messages = [messages] unless messages.is_a? Array messages.each do |message| level_pattern = /^(DEBUG|INFO|WARN|ERROR|FATAL)/ level = message.match(level_pattern)[1] message = "#{Time.now} Client " << message if ['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'].include? level Rails.logger.send(level.downcase.to_sym, message) else Rails.logger.warn('*** Attempt to log with a nonexistent level ***') Rails.logger.warn(message) end end render text: 'ok', status: :ok end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jlog-rails-0.0.5 | app/controllers/jlog/ajax_controller.rb |