gpchelkin / scdlbot

Formatted string passed to logging module PYL-W1203
Performance
Minor
6 months agoa year old
Use lazy % formatting in logging functions
1353
1354
1355async def callback_monitor(context: ContextTypes.DEFAULT_TYPE):
1356    logger.debug(f"EXECUTOR pending work items: {len(EXECUTOR._pending_work_items)} tasks remain")1357    EXECUTOR_TASKS_REMAINING.set(len(EXECUTOR._pending_work_items))
1358
1359
Use lazy % formatting in logging functions
 640        logger.debug(f"Update {update} caused ChatMigrated error: {context.error}")
 641    except TelegramError:
 642        # handle all other telegram related errors
 643        logger.debug(f"Update {update} caused TelegramError error: {context.error}") 644
 645
 646def init_chat_data(chat_data, mode="dl", flood=True):
Use lazy % formatting in logging functions
 637        logger.debug(f"Update {update} caused NetworkError error: {context.error}")
 638    except ChatMigrated as e:
 639        # the chat_id of a group has changed, use e.new_chat_id instead
 640        logger.debug(f"Update {update} caused ChatMigrated error: {context.error}") 641    except TelegramError:
 642        # handle all other telegram related errors
 643        logger.debug(f"Update {update} caused TelegramError error: {context.error}")
Use lazy % formatting in logging functions
 684    # If message just some text passed (not isinstance(message, Message)):
 685    # all_links = find_all_links(message, default_scheme="http")
 686    # urls = [link for link in all_links if url_valid_and_allowed(link)]
 687    logger.info(f"prepare_urls: urls list: {urls}") 688
 689    urls_dict = {}
 690    for url_item in urls:
Use lazy % formatting in logging functions
 631        logger.debug(f"Update {update} caused BadRequest error: {context.error}")
 632    except TimedOut:
 633        # handle slow connection problems
 634        logger.debug(f"Update {update} caused TimedOut error: {context.error}") 635    except NetworkError:
 636        # handle other connection problems
 637        logger.debug(f"Update {update} caused NetworkError error: {context.error}")