-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
debug mode: more readable logging #297
Conversation
It seems In the lib.sh we use .. Lines 112 to 114 in 9ef7f38
to detect pipes and dumb terminals ... Is there something similar we can do when initialize |
I can't find something about this, but this function should be enough: import os
import sys
def is_color_terminal():
if os.getenv('TERM', None) in ('dumb', 'unknown'):
return False
return sys.stdout.isatty() |
7cf04dc
to
db9ddd8
Compare
Updated:
|
Looks cool, I like it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested / much better to read logs, like it .. Thanks!
715f50c
to
9f110a0
Compare
metrics & processors use the engine logger
in debug mode, add some padding to make the output more readable in procution mode, add the timestamp
For example wikipedia requests use the logger name "searx.network.wikipedia" Log is disable when searx_debug is False
set: * the root logger level to WARNING * the werkzeug logger level to WARNING (useful when there is no uwsgi)
9f110a0
to
6abc37e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dalf you force pushed but did not ask for a review .. can we merge this PR anyway?
For me this PR works and I like to use this logging in my development :)
About push force fix this method: searxng/searx/network/network.py Lines 137 to 147 in 6abc37e
Before the push force, the embedded image proxy didn't work because The new value takes of that. About merging: everything works except one thing: HTTP redirect are not logged anymore. If the missing log are not an issue (it is temporary), we can merge. |
Thanks for the info, then I think it is better you decide if we should merge :) |
Ok I'm going to merge. httpx uses rich was has nice traceback logger, but it requires more configuration to fit into SearXNG. But it is a dev dependency we can change later. |
What does this PR do?
requirements-dev.txt
but optional in the code, seesearx/__init__.py
)searx.search.processors
andsearx.metrics
.searx.network.wikipedia
instead ofhttpx._client
.Make the debug log more readable:
Why is this change important?
A lot of information are logged in debug mode, which are not easy to read.
But it makes messages more difficult to find in the code:
But a
git grep
is easy:How to test this PR locally?
make run
Draft because
Author's checklist
Related issues