RaSan147 / pyrobox

Turn your computer into Local File Hosting Server. Improved version on Python 3 http.server with Upload and LOTS of FEATURES. In short a home/office remote File-Manager
MIT License
43 stars 8 forks source link

Logging verbosity #78

Open Lonerider2010 opened 1 year ago

Lonerider2010 commented 1 year ago

Running pyrobox as a systemd service, I would like to know what users are doing. So I redirect the pyrobox output to a log file. From my point of view that is too verbose. An example entry (depersonalized):

INFO: 
================================== 10digit-ID ==================================
10digit-ID|=>    request    : GET
10digit-ID|=>    url        : /dir/subdir/
10digit-ID|=>    query      : {}
10digit-ID|=>    fragment   : 
10digit-ID|=>    full url   : /dir/subdir/
++++++++++++++++++++++++++++++++++ 10digit-ID ++++++++++++++++++++++++++++++++++
INFO: 
# 10digit-ID by [URL] at [Date time]|=> "GET /dir/subdir/ HTTP/1.1" 200 -

INFO: 
---------------------------------- 10digit-ID ----------------------------------
################################################################################

That's 14 lines of information for one entry. The only information that I really need is line 10 starting with # 10digit-ID by. This line contains the same information (with small exceptions) as all other lines together.

So I propose that you add a command line option --no-verbose that delivers the information of the aforementioned line 10 only.

Thanks in advance.

RaSan147 commented 1 year ago

Thanks for the heads u. Since It uses standard logging library, so i thought there was already a CLI based log handler. I'll implement it asap

Ref: https://stackoverflow.com/questions/57192387/how-to-set-logging-level-from-command-line

RaSan147 commented 1 year ago

However the =, + and - has special meanings

= : A request has been received. The request basic data as below + : The request handling is working, the log is below - : The request has been finalized and responded and closing the connection

Lonerider2010 commented 1 year ago

Ok, thanks for this information. From my point of view, the line mentioned by me is still sufficient. That is very similar to what I get e.g. from the python http.server or the uploadserver which is also based on the http.server.

RaSan147 commented 1 year ago

Could you kindly rewrite which 10 lines? Also a word of info, INFO: WARNING: Etc are signs and part of logging, so i don't think I'll remove it. I'll keep checking different opinions

Lonerider2010 commented 1 year ago

Instead of

INFO: 
================================== 10digit-ID ==================================
10digit-ID|=>    request    : GET
10digit-ID|=>    url        : /dir/subdir/
10digit-ID|=>    query      : {}
10digit-ID|=>    fragment   : 
10digit-ID|=>    full url   : /dir/subdir/
++++++++++++++++++++++++++++++++++ 10digit-ID ++++++++++++++++++++++++++++++++++
INFO: 
# 10digit-ID by [URL] at [Date time]|=> "GET /dir/subdir/ HTTP/1.1" 200 -

INFO: 
---------------------------------- 10digit-ID ----------------------------------
################################################################################

I would like to get

INFO: # 10digit-ID by [URL] at [Date time]|=> "GET /dir/subdir/ HTTP/1.1" 200 -

only.

RaSan147 commented 1 year ago

I think that can be done... I'll look into it Thanks for the suggestion

Lonerider2010 commented 1 year ago

That sounds good. Thanks for that. You are very activ with your pyrobox, congrats.

RaSan147 commented 1 year ago

fixed it (locally) soon will be updated (massive update (ui+backend+how server works) coming. please wait a bit