Replace logging with app.logger.

This commit is contained in:
Cristiano Ferreira
2023-12-12 23:02:00 +00:00
parent 2b91cfe26d
commit 479620116d
3 changed files with 27 additions and 24 deletions

View File

@@ -9,6 +9,9 @@ from firebase_admin import credentials, firestore
from dotenv import load_dotenv
import app
def download_firebase_file(bucket_name, source_blob_name, destination_file_name):
# Downloads a file from Firebase Storage.
storage_client = storage.Client()
@@ -28,7 +31,7 @@ def upload_file_firebase(bucket_name, destination_blob_name, source_file_name):
logging.info(f"File uploaded to {destination_blob_name}")
return True
except Exception as e:
logging.error("Error uploading file to Google Cloud Storage: " + str(e))
app.app.logger.error("Error uploading file to Google Cloud Storage: " + str(e))
return False
def upload_file_firebase_get_url(bucket_name, destination_blob_name, source_file_name):
@@ -47,7 +50,7 @@ def upload_file_firebase_get_url(bucket_name, destination_blob_name, source_file
url = blob.public_url
return url
except Exception as e:
logging.error("Error uploading file to Google Cloud Storage: " + str(e))
app.app.logger.error("Error uploading file to Google Cloud Storage: " + str(e))
return None
def save_to_db(collection: str, item):