OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/helpers/open_project_error_helper.rb

37 lines
995 B

##
# Logging helper to forward to the OpenProject log delegator
# which will log and report errors appropriately.
module OpenProjectErrorHelper
def op_logger
::OpenProject.logger
end
def op_handle_error(message_or_exception, context = {})
::OpenProject.logger.error message_or_exception, context.merge(op_logging_context)
end
def op_handle_warning(message_or_exception, context = {})
::OpenProject.logger.warn message_or_exception, context.merge(op_logging_context)
end
def op_handle_info(message_or_exception, context = {})
::OpenProject.logger.info message_or_exception, context.merge(op_logging_context)
end
def op_handle_debug(message_or_exception, context = {})
::OpenProject.logger.debug message_or_exception, context.merge(op_logging_context)
end
private
def op_logging_context
{
current_user: current_user,
params: params,
request: try(:request),
session: try(:session),
env: try(:env),
}
end
end