make logging not use f-str, change others to f-str (#22882)
This commit is contained in:
@@ -22,7 +22,7 @@ def send_change_mail_task(language: str, to: str, code: str, phase: str) -> None
|
||||
if not mail.is_inited():
|
||||
return
|
||||
|
||||
logging.info(click.style("Start change email mail to {}".format(to), fg="green"))
|
||||
logging.info(click.style(f"Start change email mail to {to}", fg="green"))
|
||||
start_at = time.perf_counter()
|
||||
|
||||
try:
|
||||
@@ -35,11 +35,9 @@ def send_change_mail_task(language: str, to: str, code: str, phase: str) -> None
|
||||
)
|
||||
|
||||
end_at = time.perf_counter()
|
||||
logging.info(
|
||||
click.style("Send change email mail to {} succeeded: latency: {}".format(to, end_at - start_at), fg="green")
|
||||
)
|
||||
logging.info(click.style(f"Send change email mail to {to} succeeded: latency: {end_at - start_at}", fg="green"))
|
||||
except Exception:
|
||||
logging.exception("Send change email mail to {} failed".format(to))
|
||||
logging.exception("Send change email mail to %s failed", to)
|
||||
|
||||
|
||||
@shared_task(queue="mail")
|
||||
@@ -54,7 +52,7 @@ def send_change_mail_completed_notification_task(language: str, to: str) -> None
|
||||
if not mail.is_inited():
|
||||
return
|
||||
|
||||
logging.info(click.style("Start change email completed notify mail to {}".format(to), fg="green"))
|
||||
logging.info(click.style(f"Start change email completed notify mail to {to}", fg="green"))
|
||||
start_at = time.perf_counter()
|
||||
|
||||
try:
|
||||
@@ -72,9 +70,9 @@ def send_change_mail_completed_notification_task(language: str, to: str) -> None
|
||||
end_at = time.perf_counter()
|
||||
logging.info(
|
||||
click.style(
|
||||
"Send change email completed mail to {} succeeded: latency: {}".format(to, end_at - start_at),
|
||||
f"Send change email completed mail to {to} succeeded: latency: {end_at - start_at}",
|
||||
fg="green",
|
||||
)
|
||||
)
|
||||
except Exception:
|
||||
logging.exception("Send change email completed mail to {} failed".format(to))
|
||||
logging.exception("Send change email completed mail to %s failed", to)
|
||||
|
||||
Reference in New Issue
Block a user