mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
Try not to log search queries (#2362)
This commit is contained in:
parent
5054510d15
commit
e655af251c
1 changed files with 13 additions and 1 deletions
|
@ -17,7 +17,19 @@ class Invidious::LogHandler < Kemal::BaseLogHandler
|
|||
elapsed_time = Time.measure { call_next(context) }
|
||||
elapsed_text = elapsed_text(elapsed_time)
|
||||
|
||||
info("#{context.response.status_code} #{context.request.method} #{context.request.resource} #{elapsed_text}")
|
||||
# Default: full path with parameters
|
||||
requested_url = context.request.resource
|
||||
|
||||
# Try not to log search queries passed as GET parameters during normal use
|
||||
# (They will still be logged if log level is 'Debug' or 'Trace')
|
||||
if @level > LogLevel::Debug && (
|
||||
requested_url.downcase.includes?("search") || requested_url.downcase.includes?("q=")
|
||||
)
|
||||
# Log only the path
|
||||
requested_url = context.request.path
|
||||
end
|
||||
|
||||
info("#{context.response.status_code} #{context.request.method} #{requested_url} #{elapsed_text}")
|
||||
|
||||
context
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue