Commit da930a50 authored by Rajendra Kadam's avatar Rajendra Kadam

Use AppLogger in lib/api/* files

This MR adds AppLogger in some
files in lib/api/* and also
adds changelog for the change

Add changelog

Update changelog

Fix spec failures

Fix title in changelog

Revert change in log cursor
parent ed400ae4
---
title: Use applogger in some files of ee/lib/* and spec files
merge_request: 41056
author: Rajendra Kadam
type: other
......@@ -59,7 +59,7 @@ module Pseudonymizer
pseudonymity_columns)
)
rescue => e
Rails.logger.error("Failed to export #{table}: #{e}") # rubocop:disable Gitlab/RailsLogger
Gitlab::AppLogger.error("Failed to export #{table}: #{e}")
raise e
end
......@@ -115,7 +115,7 @@ module Pseudonymizer
file_path = output_filename(table)
headers = contents.peek.keys
Rails.logger.info "#{self.class.name} writing #{table} to #{file_path}." # rubocop:disable Gitlab/RailsLogger
Gitlab::AppLogger.info "#{self.class.name} writing #{table} to #{file_path}."
Zlib::GzipWriter.open(file_path) do |io|
csv = CSV.new(io, headers: headers, write_headers: true)
contents.each { |row| csv << row.values }
......@@ -123,7 +123,7 @@ module Pseudonymizer
file_path
rescue StopIteration
Rails.logger.info "#{self.class.name} table #{table} is empty." # rubocop:disable Gitlab/RailsLogger
Gitlab::AppLogger.info "#{self.class.name} table #{table} is empty."
nil
end
end
......
......@@ -33,7 +33,7 @@ module Pseudonymizer
pseudo_extra_fields = pseudonymized - whitelisted
pseudo_extra_fields.each do |field|
Rails.logger.warn("#{self.class.name} extraneous pseudo: #{@table}.#{field} is not whitelisted and will be ignored.") # rubocop:disable Gitlab/RailsLogger
Gitlab::AppLogger.warn("#{self.class.name} extraneous pseudo: #{@table}.#{field} is not whitelisted and will be ignored.")
end
pseudonymized & whitelisted
......
......@@ -95,7 +95,7 @@ RSpec.describe Pseudonymizer::Dumper do
}
}
expect(Rails.logger).to receive(:warn).with(/extraneous/)
expect(Gitlab::AppLogger).to receive(:warn).with(/extraneous/)
pseudo.tables_to_csv
end
......
......@@ -532,7 +532,7 @@ module API
::Gitlab::Tracking.event(category, action.to_s, **args)
rescue => error
Rails.logger.warn( # rubocop:disable Gitlab/RailsLogger
Gitlab::AppLogger.warn(
"Tracking event failed for action: #{action}, category: #{category}, message: #{error.message}"
)
end
......
......@@ -67,7 +67,7 @@ module API
result == 'PONG'
rescue => e
Rails.logger.warn("GitLab: An unexpected error occurred in pinging to Redis: #{e}") # rubocop:disable Gitlab/RailsLogger
Gitlab::AppLogger.warn("GitLab: An unexpected error occurred in pinging to Redis: #{e}")
false
end
......
......@@ -183,7 +183,7 @@ RSpec.describe API::Helpers do
end
it "logs an exception" do
expect(Rails.logger).to receive(:warn).with(/Tracking event failed/)
expect(Gitlab::AppLogger).to receive(:warn).with(/Tracking event failed/)
subject.track_event('my_event', category: nil)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment