61
62 self.dev = os.environ.get("DEV") is not None
63
64 logger.info(65 f"GIR will be running in: {self.guild_id} in \033[1m{'DEVELOPMENT' if self.dev else 'PRODUCTION'}\033[0m mode")
66 logger.info(f"Bot owned by: {self.owner_id}")
67
63
64 logger.info(
65 f"GIR will be running in: {self.guild_id} in \033[1m{'DEVELOPMENT' if self.dev else 'PRODUCTION'}\033[0m mode")
66 logger.info(f"Bot owned by: {self.owner_id}")67
68 @staticmethod
69 def setup_warning(k: str):
154 `"YbbdP"Y8 88 88
155 aa, ,88
156 "Y8bbdP" \n""")
157 logger.info(158 f'Logged in as: {bot.user.name} - {bot.user.id} ({discord.__version__})')
159 logger.info(f'Successfully logged in and booted...!')
160
156 "Y8bbdP" \n""")
157 logger.info(
158 f'Logged in as: {bot.user.name} - {bot.user.id} ({discord.__version__})')
159 logger.info(f'Successfully logged in and booted...!')160
161 await bot.ban_cache.fetch_ban_cache()
162 await bot.issue_cache.fetch_issue_cache()
301 subject = cij_filter_response.get("subject")
302
303 if None in [intent_cij, intent_news, verb]:
304 logger.error(305 f"Something went wrong with CIJ or ETA filter; {intent_cij}, {intent_news}, {verb}")
306 return
307
Formatting the message manually before passing it to a logging
call does unnecessary work if logging is disabled. Consider using the logging
module's built-in formatting features to avoid that.
If your logging level is set to "WARNING"
, but the logging call is:
logging.debug("Data: %s", data)
In the above example, there will be no logging as the level debug
is below warning
. The conversion of the data
object to a string will be skipped by the logging module resulting in improved performance.
logging.debug(f"Data: {data}")
In the code shown above, the conversion of the data
object to a string will happen regardless of whether the message is logged or not (which is based on the log level).
import logging
import inspect
logging.basicConfig(level=logging.INFO)
logging.debug(f"Entered function {inspect.stack[0][3]}"))
import logging
import inspect
logging.basicConfig(level=logging.INFO)
logging.debug("Entered function %s", inspect.stack[0][3])