From 8484041847f2f674ab802c8f16d3bcd190a770cd Mon Sep 17 00:00:00 2001 From: Kye Date: Tue, 28 Nov 2023 17:01:18 -0800 Subject: [PATCH] log errors -> disable logging --- swarms/models/__init__.py | 5 ----- swarms/utils/disable_logging.py | 5 ++++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/swarms/models/__init__.py b/swarms/models/__init__.py index b7f3b8ce..33870b31 100644 --- a/swarms/models/__init__.py +++ b/swarms/models/__init__.py @@ -1,8 +1,3 @@ -import sys - -log_file = open("errors.txt", "w") -sys.stderr = log_file - # LLMs from swarms.models.anthropic import Anthropic # noqa: E402 from swarms.models.petals import Petals # noqa: E402 diff --git a/swarms/utils/disable_logging.py b/swarms/utils/disable_logging.py index d1c7df9b..93e59bb5 100644 --- a/swarms/utils/disable_logging.py +++ b/swarms/utils/disable_logging.py @@ -1,9 +1,12 @@ import logging import os import warnings - +import sys def disable_logging(): + log_file = open("errors.txt", "w") + sys.stderr = log_file + warnings.filterwarnings("ignore", category=UserWarning) # disable tensorflow warnings