Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2176 from MeasureAuthoringTool/feature/mat-6401-a…
Browse files Browse the repository at this point in the history
…ddl-logging

[MAT-6104] Additional Logging Around Measure Create/Update
  • Loading branch information
jkotanchik-SB authored Sep 20, 2023
2 parents 0ea654b + 570ace3 commit 1743455
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
32 changes: 18 additions & 14 deletions app/controllers/measures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,24 @@ def measurement_period
private

def persist_measure(uploaded_file, permitted_params, user)
measures, main_hqmf_set_id =
if permitted_params[:hqmf_set_id].present?
update_measure(uploaded_file: uploaded_file,
target_id: permitted_params[:hqmf_set_id],
value_set_loader: build_vs_loader(permitted_params, false),
user: user)
else
create_measure(uploaded_file: uploaded_file,
measure_details: retrieve_measure_details(permitted_params),
value_set_loader: build_vs_loader(permitted_params, false),
user: user)
end
check_measures_for_unsupported_data_elements(measures)
return measures, main_hqmf_set_id
logger.tagged(user.harp_id ? user.harp_id : "unknown user") do
measures, main_hqmf_set_id =
if permitted_params[:hqmf_set_id].present?
logger.info("update")
update_measure(uploaded_file: uploaded_file,
target_id: permitted_params[:hqmf_set_id],
value_set_loader: build_vs_loader(permitted_params, false),
user: user)
else
logger.info("create")
create_measure(uploaded_file: uploaded_file,
measure_details: retrieve_measure_details(permitted_params),
value_set_loader: build_vs_loader(permitted_params, false),
user: user)
end
check_measures_for_unsupported_data_elements(measures)
return measures, main_hqmf_set_id
end
end

def check_measures_for_unsupported_data_elements(measures)
Expand Down
9 changes: 7 additions & 2 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ class Application < Rails::Application
# Configure the default encoding used in templates for Ruby 1.9.
config.encoding = "utf-8"

Rails.logger = Logger.new(STDOUT)
Rails.logger.formatter = proc do |severity, datetime, progname, msg|
# Configure log formatter
logger = Logger.new(STDOUT)
logger.formatter = proc do |severity, datetime, progname, msg|
date_format = datetime.strftime("%Y-%m-%d %H:%M:%S")
"#{date_format} [#{severity}] - #{msg}'\n"
end
Rails.logger = ActiveSupport::TaggedLogging.new(logger)

config.log_level = :info

Expand All @@ -53,6 +55,9 @@ class Application < Rails::Application
config.filter_parameters += [:vsac_api_key]
config.filter_parameters += [:api_key]

# Configure log tags that will apply to all log entries
config.log_tags = [:request_id]

# Enable escaping HTML in JSON.
config.active_support.escape_html_entities_in_json = true

Expand Down

0 comments on commit 1743455

Please sign in to comment.