Skip to content

Commit

Permalink
Minor logging changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tandemdude committed Feb 16, 2024
1 parent 5d1ed4c commit faf4c57
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lightbulb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class Example(
for guild_id in register_in:
self._commands[guild_id][name].put(command)

LOGGER.debug("command %s registered successfully", name)
LOGGER.debug("command %r (%r) registered successfully", name, command)
return command

# Used as a decorator
Expand Down Expand Up @@ -275,6 +275,7 @@ async def handle_application_command_interaction(self, interaction: hikari.Comma
Returns:
:obj:`None`
"""
# Just to double-check
if not isinstance(interaction, hikari.CommandInteraction): # type: ignore[reportUnnecessaryIsInstance]
return

Expand Down Expand Up @@ -311,14 +312,18 @@ async def handle_application_command_interaction(self, interaction: hikari.Comma

context = self.build_context(interaction, options or [], command)

LOGGER.debug("%s - invoking command", command._command_data.name)
LOGGER.debug("%r - invoking command", " ".join(command_path))

token = di._di_container.set(self._di_container)
try:
await execution.ExecutionPipeline(context, self._execution_step_order)._run()
except Exception as e:
# TODO - dispatch to error handler
LOGGER.error("Error encountered during command processing", exc_info=(type(e), e, e.__traceback__))
LOGGER.error(
"Error encountered during invocation of command %r",
" ".join(command_path),
exc_info=(type(e), e, e.__traceback__),
)
finally:
di._di_container.reset(token)

Expand Down

0 comments on commit faf4c57

Please sign in to comment.