Skip to content

Commit

Permalink
Removed unwanted logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepika Gonuguntla authored and deepikagonuguntla committed Nov 12, 2024
1 parent c88459f commit cd65ff4
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 55 deletions.
9 changes: 0 additions & 9 deletions app/controllers/holds_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class HoldsController < ApplicationController
end

def index
LogWrapper.log('DEBUG', {'message' => 'index.start', 'method' => 'app/controllers/holds_controller.rb.index'})
redirect_to root_url
end

Expand All @@ -20,8 +19,6 @@ def index
# their holds history. In routing terms, responds to a GET request on the
# /holds/[hold id].json url.
def show
LogWrapper.log('DEBUG', {'message' => 'show.start', 'method' => 'app/controllers/holds_controller.rb.show'})

@hold = Hold.find_by_access_key(params[:id])
head 401 if @hold.nil?

Expand All @@ -35,7 +32,6 @@ def show

# GET /holds/new.json
def new
LogWrapper.log('DEBUG', {'message' => 'new.start', 'method' => 'app/controllers/holds_controller.rb.new'})
@hold = Hold.new
@hold.teacher_set = TeacherSet.find params[:teacher_set_id]
render json: {
Expand All @@ -47,7 +43,6 @@ def new

# GET /holds/1/cancel.json
def cancel
LogWrapper.log('DEBUG', {'message' => 'cancel.start', 'method' => 'app/controllers/holds_controller.rb.cancel'})
@hold = Hold.find_by_access_key(params[:id])
head 401 if @hold.nil?
render json: {
Expand All @@ -62,7 +57,6 @@ def cancel
# Create holds and update quantity column in holds.
# Calculate available copies from quantity saves in teacherset table.
def create
LogWrapper.log('DEBUG', {'message' => 'create.start', 'method' => 'app/controllers/holds_controller.rb.create'})
begin
# If user's school is inactive, then display an error message and redirect to teacher set detail page.
is_school_active = current_user.school_id.present? ? School.find(current_user.school_id).active : false
Expand Down Expand Up @@ -109,7 +103,6 @@ def create


def error_message(exception)
LogWrapper.log('ERROR', 'message' => exception.message)
# Note: don't need an explicit return here
respond_to do |format|
format.html {}
Expand All @@ -123,7 +116,6 @@ def error_message(exception)

# Here calculate the teacher-set available_copies based on the current-user holds than saves in teacher-set table and cancel the current-user holds.
def update
LogWrapper.log('DEBUG', {'message' => 'update.start', 'method' => 'app/controllers/holds_controller.rb.update'})
@hold = Hold.find_by_access_key(params[:id])

unless (c = params[:hold_change]).nil?
Expand Down Expand Up @@ -151,7 +143,6 @@ def update
protected

def check_ownership
LogWrapper.log('DEBUG', {'message' => 'check_ownership.start', 'method' => 'app/controllers/holds_controller.rb.check_ownership'})
@hold = Hold.find_by_access_key(params[:id])

if not user_signed_in?
Expand Down
1 change: 0 additions & 1 deletion app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class RegistrationsController < Devise::RegistrationsController
# In addition, overriding the method allows us to validate the incoming data from the form, send the data
# to the microservice, and create a record on MyLibraryNYC depending on if the microservice is working properly.
def create
LogWrapper.log('INFO','message' => "Creating new user record")
build_resource(sign_up_params)
if resource.valid?
begin
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/teacher_sets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class TeacherSetsController < ApplicationController
# Called on loading the teacher set list page and when the user selects
# a facet to filter by.
def index
LogWrapper.log('DEBUG', {'message' => 'index.start', 'method' => 'app/controllers/teacher_sets_controller.rb.index'})
begin
# Feature flag: 'teacherset.data.from.elasticsearch.enabled = true' means gets teacher-set documents from elastic search.
# teacherset.data.from.elasticsearch.enabled = false means gets teacher-set data from database.
Expand Down Expand Up @@ -92,8 +91,6 @@ def teacher_set_facets(params)

# GET /teacher_sets/1.json
def show
LogWrapper.log('DEBUG', {'message' => 'show.start', 'method' => 'app/controllers/teacher_sets_controller.rb.show'})

# Stores the current location in session, so if an un-authenticated user
# tries to order this teacher set, we can ask the user to sign in, and
# then redirect back to this teacher_set detail page.
Expand Down Expand Up @@ -139,7 +136,6 @@ def show

# Gets current user teacherset holds from database.
def teacher_set_holds
LogWrapper.log('DEBUG', {'message' => 'teacher_set_holds.start', 'method' => 'app/controllers/teacher_sets_controller.rb.teacher_set_holds'})
@set = TeacherSet.find(params[:id])
@holds = @set.holds_for_user(current_user)
end
Expand Down
12 changes: 0 additions & 12 deletions app/mailers/admin_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ def failed_bibs_controller_api_request(request_body, error_code_and_message, act
@request_body = request_body
@error_code_and_message = error_code_and_message
emails = AdminUser.where(email_notifications:true).pluck(:email)
LogWrapper.log('DEBUG', {
'message' => "About to send failed_bibs_controller_api_request email.\n@error_code_and_message: #{@error_code_and_message || 'nil'}",
'method' => 'AdminMailer.failed_bibs_controller_api_request'
})
mail(:to => emails, :subject => "Problem occurred updating bib from Sierra")
rescue => exception
LogWrapper.log('ERROR', {
Expand All @@ -35,10 +31,6 @@ def teacher_set_update_missing_required_fields(bnumber, title, physical_descript
@title = title
@physical_description = physical_description
emails = AdminUser.where(email_notifications:true).pluck(:email)
LogWrapper.log('DEBUG', {
'message' => "About to send failed_bibs_controller_api_request email",
'method' => 'AdminMailer teacher_set_update_missing_required_fields'
})
mail(:to => emails, :subject => "New teacher set bib in Sierra is missing required fields")
rescue => exception
LogWrapper.log('ERROR', {
Expand All @@ -54,10 +46,6 @@ def teacher_set_update_missing_required_fields(bnumber, title, physical_descript
def failed_items_controller_api_request(error_code_and_message)
begin
emails = AdminUser.where(email_notifications:true).pluck(:email)
LogWrapper.log('DEBUG', {
'message' => "About to send failed_items_controller_api_request email.\n@error_code_and_message: #{@error_code_and_message || 'nil'}",
'method' => 'AdminMailer.failed_items_controller_api_request'
})
mail(:to => emails, :subject => "Problem occurred updating bib availability")
rescue => exception
LogWrapper.log('ERROR', {
Expand Down
12 changes: 0 additions & 12 deletions app/mailers/hold_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ def admin_notification(hold)
@user = hold.user
@teacher_set = hold.teacher_set
emails = AdminUser.where(email_notifications:true).pluck(:email)
LogWrapper.log('DEBUG', {
'message' => "About to send hold order admin notification email on #{@teacher_set.title or 'unknown'} to #{@user.email or 'unknown'}",
'method' => 'HoldMailer admin_notification'
})
mail(:to => emails, :subject => "New Order from #{@user.email or 'unknown'} for #{@teacher_set.title or 'unknown'}")
rescue => exception
LogWrapper.log('ERROR', {
Expand All @@ -37,10 +33,6 @@ def confirmation(hold)
@hold = hold
@user = hold.user
@teacher_set = hold.teacher_set
LogWrapper.log('DEBUG', {
'message' => "About to send patron hold order notification email to #{@user.email}",
'method' => 'HoldMailer confirmation'
})
mail(:to => @user.contact_email, :subject => "Your order confirmation for #{@teacher_set.title}")
rescue => exception
LogWrapper.log('ERROR', {
Expand All @@ -59,10 +51,6 @@ def status_change(hold, status, details)
@user = hold.user
@teacher_set = hold.teacher_set
@details = details
LogWrapper.log('DEBUG', {
'message' => "status_change: About to send status_change notification email to #{@user.email}",
'method' => 'HoldMailer status_change'
})
mail(:to => @user.contact_email, :subject => "Order #{@hold.status} | Your teacher set order for #{@teacher_set.title}")
rescue => exception
LogWrapper.log('ERROR', {
Expand Down
4 changes: 0 additions & 4 deletions app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ class UserMailer < ActionMailer::Base
def unsubscribe(user)
begin
@user = user
LogWrapper.log('DEBUG', {
'message' => "About to send unsubscribe confirmation email to #{@user.email or 'unknown'}",
'method' => 'UserMailer unsubscribe'
})
mail(:to => @user.contact_email, :subject => "You have now unsubscribed from MyLibraryNyc.")
rescue => exception
# something went wrong. perhaps the user isn't set properly, or maybe the email couldn't be sent out.
Expand Down
7 changes: 0 additions & 7 deletions app/models/book.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,6 @@ def update_from_isbn

# Sends a request to the bibs microservice.
def send_request_to_bibs_microservice
LogWrapper.log('DEBUG', {
'message' => 'Request sent to bibs service',
'method' => 'send_request_to_bibs_microservice',
'status' => 'start',
'dataSent' => ENV['BIBS_MICROSERVICE_URL_V01'] + "?standardNumber=#{isbn}"
})
response = HTTParty.get(
ENV['BIBS_MICROSERVICE_URL_V01'] + "?standardNumber=#{isbn}",
headers:
Expand All @@ -208,7 +202,6 @@ def send_request_to_bibs_microservice
timeout: 10
)


case response.code
when 200
@book_found = true
Expand Down
6 changes: 0 additions & 6 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,6 @@ def send_request_to_patron_creator_service
"content": school.name
}]
}
LogWrapper.log('DEBUG', {
'message' => 'Request sent to patron creator service',
'method' => 'send_request_to_patron_creator_service',
'status' => 'start',
'dataSent' => query
})
response = HTTParty.post(
ENV['PATRON_MICROSERVICE_URL_V02'],
body: query.to_json,
Expand Down

0 comments on commit cd65ff4

Please sign in to comment.