aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bot/__init__.py28
-rw-r--r--bot/constants.py7
-rw-r--r--config-default.yml5
3 files changed, 19 insertions, 21 deletions
diff --git a/bot/__init__.py b/bot/__init__.py
index 840c7b47c..de3d4d782 100644
--- a/bot/__init__.py
+++ b/bot/__init__.py
@@ -4,7 +4,6 @@ import os
import re
import sys
from logging import Logger, StreamHandler
-from logging.handlers import SysLogHandler
import discord.ext.commands.view
from logmatic import JsonFormatter
@@ -58,14 +57,25 @@ logging.basicConfig(
log = logging.getLogger(__name__)
-# We need to defer the import from `constants.py`
-# because otherwise the logging config would not be applied
-# to any logging done in the module.
-from bot.constants import Papertrail # noqa
-if Papertrail.address:
- papertrail_handler = SysLogHandler(address=(Papertrail.address, Papertrail.port))
- papertrail_handler.setLevel(logging.DEBUG)
- logging.getLogger('bot').addHandler(papertrail_handler)
+
+for key, value in logging.Logger.manager.loggerDict.items():
+ # Force all existing loggers to the correct level and handlers
+ # This happens long before we instantiate our loggers, so
+ # those should still have the expected level
+
+ if key == "bot":
+ continue
+
+ if not isinstance(value, logging.Logger):
+ # There might be some logging.PlaceHolder objects in there
+ continue
+
+ if DEBUG_MODE:
+ value.setLevel(logging.DEBUG)
+ else:
+ value.setLevel(logging.INFO)
+
+ value.handlers = logging_handlers
# Silence discord and websockets
diff --git a/bot/constants.py b/bot/constants.py
index 50a316d26..c512480c5 100644
--- a/bot/constants.py
+++ b/bot/constants.py
@@ -233,13 +233,6 @@ class ClickUp(metaclass=YAMLGetter):
key: str
-class Papertrail(metaclass=YAMLGetter):
- section = "papertrail"
-
- address: str
- port: str
-
-
class RabbitMQ(metaclass=YAMLGetter):
section = "rabbitmq"
diff --git a/config-default.yml b/config-default.yml
index e10150617..3a20d10c6 100644
--- a/config-default.yml
+++ b/config-default.yml
@@ -55,11 +55,6 @@ clickup:
key: !ENV 'CLICKUP_KEY'
-papertrail:
- address: !ENV 'PAPERTRAIL_ADDRESS'
- port: !ENV 'PAPERTRAIL_PORT'
-
-
rabbitmq:
host: "pdrmq"
port: 5672