Skip to content

Commit

Permalink
Merge pull request #2220 from dhdaines/debug_logs
Browse files Browse the repository at this point in the history
Add extra information to debug logs
  • Loading branch information
liZe authored Aug 2, 2024
2 parents 992133a + 40d9afb commit 3b6c8ef
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion weasyprint/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,14 @@ def main(argv=None, stdout=None, stdin=None, HTML=HTML): # noqa: N803
LOGGER.setLevel(logging.INFO)
if not args.quiet:
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
if args.debug:
# Add extra information when debug logging
handler.setFormatter(
logging.Formatter(
'%(levelname)s: %(filename)s:%(lineno)d '
'(%(funcName)s): %(message)s'))
else:
handler.setFormatter(logging.Formatter('%(levelname)s: %(message)s'))
LOGGER.addHandler(handler)

html = HTML(
Expand Down

0 comments on commit 3b6c8ef

Please sign in to comment.