diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index ce06754..0e7fb69 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -77,8 +77,8 @@ en:
chatbot_serp_api_key: "Serp API token for google search (if left blank, google will never be searched). Get one at SerpAPI.com"
chatbot_marketstack_key: "Marketstack API key for stock price information (if left blank, Marketstack will never be queried).Get one at MarketStack.com"
chatbot_enable_verbose_console_logging: "Enable response retrieval progress logging to console to help debug issues"
- chatbot_enable_verbose_rails_logging: "Enable response retrieval progress logging to rails logs to help debug issues"
-
+ chatbot_enable_verbose_rails_logging: "Enable response retrieval progress logging to rails logs to help debug issues. 'api_calls_only' restricts this to just API calls, 'all' logs all progress"
+ chatbot_verbose_rails_logging_destination_level: "Choose which category of logs to send verbose logs to. 'warn' is useful in Production as 'info' logs are not exposed at /logs."
chatbot:
bio: "Hi, I'm not a real person. I'm a bot that can discuss things with you. Don't take me too seriously. Sometimes, I'm even right about stuff!"
pm_prefix: "A Discussion with Chatbot"
diff --git a/config/settings.yml b/config/settings.yml
index f4cf39c..f43f0a1 100644
--- a/config/settings.yml
+++ b/config/settings.yml
@@ -352,4 +352,16 @@ plugins:
default: false
chatbot_enable_verbose_rails_logging:
client: false
- default: false
+ type: enum
+ default: 'off'
+ choices:
+ - 'off'
+ - 'api_calls_only'
+ - 'all'
+ chatbot_verbose_rails_logging_destination_level:
+ client: false
+ type: enum
+ default: 'info'
+ choices:
+ - 'info'
+ - 'warn'
diff --git a/lib/discourse_chatbot/bots/open_ai_bot_base.rb b/lib/discourse_chatbot/bots/open_ai_bot_base.rb
index 92868a0..886a2b6 100644
--- a/lib/discourse_chatbot/bots/open_ai_bot_base.rb
+++ b/lib/discourse_chatbot/bots/open_ai_bot_base.rb
@@ -29,7 +29,14 @@ def initialize(opts)
@client = OpenAI::Client.new do |f|
f.response :logger, Logger.new($stdout), bodies: true if SiteSetting.chatbot_enable_verbose_console_logging
- f.response :logger, Rails.logger, bodies: true if SiteSetting.chatbot_enable_verbose_rails_logging
+ if SiteSetting.chatbot_enable_verbose_rails_logging != "off"
+ case SiteSetting.chatbot_verbose_rails_logging_destination
+ when "warn"
+ f.response :logger, Rails.logger, bodies: true, log_level: :warn
+ else
+ f.response :logger, Rails.logger, bodies: true, log_level: :info
+ end
+ end
end
@model_name =
diff --git a/plugin.rb b/plugin.rb
index aa0f55e..51298a1 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# name: discourse-chatbot
# about: a plugin that allows you to have a conversation with a configurable chatbot in Discourse Chat, Topics and Private Messages
-# version: 0.9.31
+# version: 0.9.32
# authors: merefield
# url: https://github.com/merefield/discourse-chatbot
@@ -39,7 +39,14 @@ module ::DiscourseChatbot
def progress_debug_message(message)
puts "Chatbot: #{message}" if SiteSetting.chatbot_enable_verbose_console_logging
- Rails.logger.info("Chatbot: #{message}") if SiteSetting.chatbot_enable_verbose_rails_logging
+ if SiteSetting.chatbot_enable_verbose_rails_logging == "all"
+ case SiteSetting.chatbot_verbose_rails_logging_destination
+ when "warn"
+ Rails.logger.warn("Chatbot: #{message}")
+ else
+ Rails.logger.info("Chatbot: #{message}")
+ end
+ end
end
module_function :progress_debug_message