Commit fc83a730 authored by Rajendra Kadam's avatar Rajendra Kadam Committed by Peter Leitzen

Use applogger in akismet service

parent 11271ac4
......@@ -27,7 +27,7 @@ module Spam
is_spam, is_blatant = akismet_client.check(options[:ip_address], options[:user_agent], params)
is_spam || is_blatant
rescue => e
Rails.logger.error("Unable to connect to Akismet: #{e}, skipping check") # rubocop:disable Gitlab/RailsLogger
Gitlab::AppLogger.error("Unable to connect to Akismet: #{e}, skipping check")
false
end
end
......@@ -67,7 +67,7 @@ module Spam
akismet_client.public_send(type, options[:ip_address], options[:user_agent], params) # rubocop:disable GitlabSecurity/PublicSend
true
rescue => e
Rails.logger.error("Unable to connect to Akismet: #{e}, skipping!") # rubocop:disable Gitlab/RailsLogger
Gitlab::AppLogger.error("Unable to connect to Akismet: #{e}, skipping!")
false
end
end
......
---
title: Use applogger in akismet service
merge_request: 32205
author: Rajendra Kadam
type: fixed
......@@ -45,9 +45,7 @@ describe Spam::AkismetService do
end
it 'logs an error' do
logger_spy = double(:logger)
expect(Rails).to receive(:logger).and_return(logger_spy)
expect(logger_spy).to receive(:error).with(/skipping/)
expect(Gitlab::AppLogger).to receive(:error).with(/skipping/)
subject.send(method_call)
end
......@@ -98,9 +96,7 @@ describe Spam::AkismetService do
end
it 'logs an error' do
logger_spy = double(:logger)
expect(Rails).to receive(:logger).and_return(logger_spy)
expect(logger_spy).to receive(:error).with(/skipping check/)
expect(Gitlab::AppLogger).to receive(:error).with(/skipping check/)
subject.spam?
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