Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pythonforandroid/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ def shprint(command, *args, **kwargs):
kwargs["_bg"] = True
is_critical = kwargs.pop('_critical', False)
tail_n = kwargs.pop('_tail', None)
full_debug = False
if "P4A_FULL_DEBUG" in os.environ:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestion: we could also write a one-liner that is still very readable:

full_debug = "P4A_FULL_DEBUG" in os.environ

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look below, it also have an impact on tail_n

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True story 👍

tail_n = 0
full_debug = True
filter_in = kwargs.pop('_filter', None)
filter_out = kwargs.pop('_filterout', None)
if len(logger.handlers) > 1:
Expand Down Expand Up @@ -177,6 +179,10 @@ def shprint(command, *args, **kwargs):
if isinstance(line, bytes):
line = line.decode('utf-8', errors='replace')
if logger.level > logging.DEBUG:
if full_debug:
stdout.write(line)
stdout.flush()
continue
msg = line.replace(
'\n', ' ').replace(
'\t', ' ').replace(
Expand Down