0

I'm making an app in Python using Supabase and Rich. Everytime I make a request to the Supabase API, Rich will print some kind of log, and I don't know if this is a feature that I can disable or a bug.

enter image description here

I've tried uninstalling Rich and Supabase does not give any output by default.

Also, I've reduced the algorithm to a basic testing file. This is the only thing I do, so it's nothing I could've configured.

from os import environ
from dotenv import load_dotenv
from supabase import Client, create_client

load_dotenv()

URL: str = environ.get('SUPABASE_URL')
KEY: str = environ.get('SUPABASE_KEY')

supa: Client = create_client(URL, KEY)

query = supa.table('watched').select('*').execute()

Solution

Finally I've solved it after trying some methods:

import logging
import sys

supabase_logger = logging.getLogger('supabase')
rich_logger = logging.getLogger('rich')

# Method 1
supabase_logger.propagate = False
rich_logger.propagate = False

# Method 2
supabase_logger.disabled = True
rich_logger.disabled = True

# Method 3 (51 must be any number above 50)
logging.disable(51)

# Method 4 (This is the one that worked for me)
logging.disable(sys.maxsize)
Sylph1de
  • 1
  • 2
  • 1
    Is this the whole code? It doesn't look like you are importing rich here – Apollo-Roboto Aug 23 '23 at 19:05
  • Yes, this is the whole code. I'm not importing it, but it's installed in the interpreter. When I uninstall it the output it's not there. – Sylph1de Aug 23 '23 at 19:07
  • 2
    I'm really confused about what you're asking here. It's perfectly normal for a server to log requests – roganjosh Aug 23 '23 at 19:12
  • This doesn't sound like a bug. More likely you just need to change your application's logging configs to meet your need; e.g. not send the access log events to the console. There should be documentation on how to do this. – Stephen C Aug 23 '23 at 19:15
  • I've finally solved it thanks to the answer by collins cheruiyot and some further research. Solution will be added to the post itself. – Sylph1de Aug 23 '23 at 19:35

1 Answers1

0

#likely due to the default logging configuration in the Supabase Python library

import logging

#Disable logging from the Supabase library
logging.getLogger("supabase").setLevel(logging.WARNING)
toyota Supra
  • 3,181
  • 4
  • 15
  • 19