FIX: Use `Discourse.deprecate` instead of `Rails.logger.warn`

FIX: Use Discourse.deprecate instead of Rails.logger.warn

This will significantly reduce the volume of logs when the condition is hit

From 052bf375782164b6dfce0d35f9719f80f776afcb Mon Sep 17 00:00:00 2001
From: David Taylor <david@taylorhq.com>
Date: Thu, 22 Nov 2018 15:59:47 +0000
Subject: [PATCH] FIX: Use `Discourse.deprecate` instead of `Rails.logger.warn`

This will significantly reduce the volume of logs when the condition is hit

diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb
index ac575b1..f304dee 100644
--- a/lib/plugin/instance.rb
+++ b/lib/plugin/instance.rb
@@ -497,9 +497,9 @@ class Plugin::Instance
         provider.authenticator.enabled?
       rescue NotImplementedError
         provider.authenticator.define_singleton_method(:enabled?) do
-          Rails.logger.warn("#{provider.authenticator.class.name} should define an `enabled?` function. Patching for now.")
+          Discourse.deprecate("#{provider.authenticator.class.name} should define an `enabled?` function. Patching for now.")
           return SiteSetting.send(provider.enabled_setting) if provider.enabled_setting
-          Rails.logger.warn("#{provider.authenticator.class.name} has not defined an enabled_setting. Defaulting to true.")
+          Discourse.deprecate("#{provider.authenticator.class.name} has not defined an enabled_setting. Defaulting to true.")
           true
         end
       end

GitHub

2 Likes