Added filter to logging configuration to exclude logs containing the string 'DEBUG'
This commit is contained in:
@@ -19,12 +19,20 @@ client = OpenAI()
|
|||||||
GPT_4O = "gpt-4o"
|
GPT_4O = "gpt-4o"
|
||||||
GPT_4O_MINI = "gpt-4o-mini"
|
GPT_4O_MINI = "gpt-4o-mini"
|
||||||
|
|
||||||
# Set up logging to console and file
|
class NoDebugFilter(logging.Filter):
|
||||||
|
def filter(self, record):
|
||||||
|
return "DEBUG" not in record.getMessage()
|
||||||
|
|
||||||
|
# Set up logging to console and file with filter
|
||||||
logging.basicConfig(level=logging.INFO, handlers=[
|
logging.basicConfig(level=logging.INFO, handlers=[
|
||||||
logging.StreamHandler(),
|
logging.StreamHandler(),
|
||||||
logging.FileHandler('logs/output.log', mode='a')
|
logging.FileHandler('logs/output.log', mode='a')
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# Add filter to the handlers
|
||||||
|
for handler in logging.getLogger().handlers:
|
||||||
|
handler.addFilter(NoDebugFilter())
|
||||||
|
|
||||||
# Set up Telegram bot
|
# Set up Telegram bot
|
||||||
TELEGRAM_BOT_TOKEN = os.getenv('TELEGRAM_BOT_TOKEN')
|
TELEGRAM_BOT_TOKEN = os.getenv('TELEGRAM_BOT_TOKEN')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user