Refactor: use logger = logging.getLogger(__name__) in logging (#24515)

Co-authored-by: Yongtao Huang <99629139+hyongtao-db@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
Yongtao Huang
2025-08-26 18:10:31 +08:00
committed by GitHub
parent 8af2ae973f
commit fa753239ad
102 changed files with 565 additions and 401 deletions

View File

@@ -11,6 +11,8 @@ from extensions.ext_database import db
from libs.datetime_utils import naive_utc_now
from models.dataset import Document
logger = logging.getLogger(__name__)
@document_index_created.connect
def handle(sender, **kwargs):
@@ -19,7 +21,7 @@ def handle(sender, **kwargs):
documents = []
start_at = time.perf_counter()
for document_id in document_ids:
logging.info(click.style(f"Start process document: {document_id}", fg="green"))
logger.info(click.style(f"Start process document: {document_id}", fg="green"))
document = (
db.session.query(Document)
@@ -44,6 +46,6 @@ def handle(sender, **kwargs):
indexing_runner = IndexingRunner()
indexing_runner.run(documents)
end_at = time.perf_counter()
logging.info(click.style(f"Processed dataset: {dataset_id} latency: {end_at - start_at}", fg="green"))
logger.info(click.style(f"Processed dataset: {dataset_id} latency: {end_at - start_at}", fg="green"))
except DocumentIsPausedError as ex:
logging.info(click.style(str(ex), fg="yellow"))
logger.info(click.style(str(ex), fg="yellow"))