diff --git a/latex_commands.py b/latex_commands.py index 4a418bd..168ad56 100644 --- a/latex_commands.py +++ b/latex_commands.py @@ -31,18 +31,21 @@ class LatexModule(commands.Cog): ) @commands.has_any_role(*ALLOWED_ROLES) async def tex(self, ctx: commands.Context, include_source_excerpt: Optional[bool] = True): + self.logger.info("LaTeX command invoked by %s", ctx.author) ch = ctx.message.channel async with ch.typing(): atts = [a for a in (ctx.message.attachments or []) if is_tex_attachment(a, LATEX_MAX_ATTACH_MB)] if not atts: return await ctx.reply(f"Dołącz .tex (≤{LATEX_MAX_ATTACH_MB} MiB).", mention_author=False) - + self.logger.debug("LaTeX attachments: %s", ", ".join(a.filename for a in atts)) files: List[discord.File] = [] parts: List[str] = [] for att in atts: try: data = await att.read() + self.logger.debug("LaTeX read %s bytes from %s", len(data), att.filename) res = await compile_single_tex_bytes(data, att.filename, LATEX_TEX_ENGINE, LATEX_MAX_COMPILE_SECONDS, logger=self.logger) + self.logger.debug("LaTeX result for %s: %s", att.filename, res) self.logger.debug("LaTeX log (%s)\n%s", att.filename, (res["log_text"] or "")[-2000:]) if res["ok"] and res["pdf_bytes"]: b = io.BytesIO(res["pdf_bytes"])