-
Notifications
You must be signed in to change notification settings - Fork 3
Logging
YumYummity edited this page Feb 8, 2024
·
2 revisions
Overview / Setup / Cogs / Logging / Examples
- Use
bot.traceback(Exception)
to log and format errors. Otherwise, they won't be logged properly.- You can use
print()
for debug statements you don't want logged.
- You can use
- Use
bot.print()
to print things. Otherwise, it won't be logged properly. This will also add a timestamp.- You can use
print()
for debug statements you don't want logged.
- You can use
- Use
bot.info()
to print info messages. - Use
bot.error()
to print error messages. - Use
bot.success()
to print success messages. - Use
bot.warn()
to print warning messages.
- You can use
bot.COLORS.item_name
when logging to highlight a input or item in logs.- Example:
f"A user ran the command {bot.COLORS.item_name}!help{bot.COLORS.normal_message} on a server."
- Example:
- You can use
bot.COLORS.user_name
when logging to highlight a user's name in logs.- Example:
f"{bot.COLORS.user_name}{ctx.author.name}{bot.COLORS.normal_message} ran a command.
- Example:
- You can use
bot.COLORS.cog_logs
to color a [COGS] log. (Usebot.print
!)- Example:
bot.print(f"{bot.COLORS.cog_logs}[COGS]{bot.COLORS.normal_message} Loaded cog.")
-
error_logs
,warn_logs
,info_logs
, andsuccess_logs
are also available, but it is recommended to use thebot.error()
,bot.warn()
,bot.info()
, andbot.success()
functions instead. -
guilded_logs
is available, but it is recommended to leave that to theguilded.py
logger and not use it.
- Example:
- You can use
bot.COLORS.reset
to completely reset any formatting. - You can use
bot.COLORS.normal_message
to format normal text in logs. -
bot.COLORS.timestamp
exists as a color for the timestamps in front of a log message. You can use it to highlight any timestamps you may have.
Edit the following class
in main.py
to change colors.