Commit 565bef3b authored by Rajendra Kadam's avatar Rajendra Kadam

Adding Gitlab AppLogger

This MR adds AppLogger for listener
cleaner and helper spec files
And also adds changelog for the
change

Add changelog

Update changelog

Fix spec failures and change title in changelog

Remove cop disable for RailsLogger
parent 2186dc81
---
title: Use AppLogger in listener.rb, cleaner.rake, helpers.rb and spec files
merge_request: 41116
author: Rajendra Kadam
type: other
...@@ -32,21 +32,19 @@ module RspecFlaky ...@@ -32,21 +32,19 @@ module RspecFlaky
flaky_examples[current_example.uid] = flaky_example flaky_examples[current_example.uid] = flaky_example
end end
# rubocop:disable Gitlab/RailsLogger
def dump_summary(_) def dump_summary(_)
RspecFlaky::Report.new(flaky_examples).write(RspecFlaky::Config.flaky_examples_report_path) RspecFlaky::Report.new(flaky_examples).write(RspecFlaky::Config.flaky_examples_report_path)
# write_report_file(flaky_examples, RspecFlaky::Config.flaky_examples_report_path) # write_report_file(flaky_examples, RspecFlaky::Config.flaky_examples_report_path)
new_flaky_examples = flaky_examples - suite_flaky_examples new_flaky_examples = flaky_examples - suite_flaky_examples
if new_flaky_examples.any? if new_flaky_examples.any?
Rails.logger.warn "\nNew flaky examples detected:\n" Gitlab::AppLogger.warn "\nNew flaky examples detected:\n"
Rails.logger.warn Gitlab::Json.pretty_generate(new_flaky_examples.to_h) Gitlab::AppLogger.warn Gitlab::Json.pretty_generate(new_flaky_examples.to_h)
RspecFlaky::Report.new(new_flaky_examples).write(RspecFlaky::Config.new_flaky_examples_report_path) RspecFlaky::Report.new(new_flaky_examples).write(RspecFlaky::Config.new_flaky_examples_report_path)
# write_report_file(new_flaky_examples, RspecFlaky::Config.new_flaky_examples_report_path) # write_report_file(new_flaky_examples, RspecFlaky::Config.new_flaky_examples_report_path)
end end
end end
# rubocop:enable Gitlab/RailsLogger
private private
......
...@@ -178,19 +178,17 @@ namespace :gitlab do ...@@ -178,19 +178,17 @@ namespace :gitlab do
end end
end end
# rubocop:disable Gitlab/RailsLogger
def logger def logger
return @logger if defined?(@logger) return @logger if defined?(@logger)
@logger = if Rails.env.development? || Rails.env.production? @logger = if Rails.env.development? || Rails.env.production?
Logger.new(STDOUT).tap do |stdout_logger| Logger.new(STDOUT).tap do |stdout_logger|
stdout_logger.extend(ActiveSupport::Logger.broadcast(Rails.logger)) stdout_logger.extend(ActiveSupport::Logger.broadcast(Gitlab::AppLogger))
stdout_logger.level = debug? ? Logger::DEBUG : Logger::INFO stdout_logger.level = debug? ? Logger::DEBUG : Logger::INFO
end end
else else
Rails.logger Gitlab::AppLogger
end end
end end
# rubocop:enable Gitlab/RailsLogger
end end
end 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