mirror of https://github.com/iv-org/invidious.git
Try not to log search queries (#2362)
This commit is contained in:
parent
5054510d15
commit
e655af251c
|
@ -17,7 +17,19 @@ class Invidious::LogHandler < Kemal::BaseLogHandler
|
||||||
elapsed_time = Time.measure { call_next(context) }
|
elapsed_time = Time.measure { call_next(context) }
|
||||||
elapsed_text = elapsed_text(elapsed_time)
|
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
|
context
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue