Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more unique yet short paths for logging #2642

Merged
merged 3 commits into from
Nov 30, 2020

Conversation

purplesyringa
Copy link
Contributor

@purplesyringa purplesyringa commented Oct 13, 2020

Now ZeroNet logs tend to be literally useless for debugging because most of the paths are incomprehensible. I propose replacing the path shortening algorithm with a more subtle one. Here are the major changes:

  1. Paths such as src/Ui/__init__.py, should they appear in a traceback, are now encoded as Ui/__init__.py (was: __init__.py).
  2. Paths such as plugins/Chart/ChartDb.py are now encoded as ChartDb.py (was: Chart/ChartDb.py). In general, paths such as A/AB/ABC/X.py are now encoded as ABC/X.py to remove unnecessary prefixes.
  3. Paths such as <frozen importlib._bootstrap>, which may appear in a traceback due to import errors, are now skipped (was: <frozen importlib._bootstrap>).
  4. As the algorithm has changed from 'only keep specific prefixes' (ex.: plugin name) to 'only remove unnecessary prefixes' (ex.: .../src/), paths outside ZeroNet root, should they appear in a traceback, are now anonymized: /root/ZeroNet/src/main.py is now encoded as ?/src/main.py (was: main.py).
  5. Third-party module paths now include module name: .../site-packages/gevent/__init__.py is now encoded as <gevent>/__init__.py (was: __init__.py).
  6. Builtin python modules are now visibly separated from ZeroNet files: /usr/lib/python3.8/os.py is now encoded as <os> (was: os.py).
  7. Gevent paths such as src/gevent/event.py are correctly parsed as <gevent>/event.py (was: event.py).

I've also added some tests.

@HelloZeroNet HelloZeroNet merged commit 40db30a into HelloZeroNet:py3 Nov 30, 2020
@HelloZeroNet
Copy link
Owner

Thanks, looks better this way, added some fix for Windows path separators: ecfb6b6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants