Sha256: 44cbdeb3bdcb055cc382368bc00013d82c23406ad7395889ba9080dfc8acaf49
Contents?: true
Size: 775 Bytes
Versions: 4
Compression:
Stored size: 775 Bytes
Contents
module Jlog class AjaxController < ActionController::Metal include ActionController::Rendering Levels = ['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'] LevelsPattern = Regexp.new("^(#{Levels.join("|")})", Regexp::IGNORECASE) def append messages = Array(params[:message]) messages.each do |message| path = request.original_fullpath output = JLog.formatter(path).call(:path => path, :message => message) if message =~ LevelsPattern level = $1 JLog.logger(path).send(level.downcase.to_sym, output) else JLog.logger.warn('*** Attempt to log with a nonexistent level ***') JLog.logger.warn(output) end end render text: 'ok', status: :ok end end end
Version data entries
4 entries across 4 versions & 1 rubygems