httplog icon indicating copy to clipboard operation
httplog copied to clipboard

Allow/block the logging on runtime

Open sobrinho opened this issue 2 years ago • 3 comments

Hi there,

I would like to toggle certain URLs without restarting my app server.

I have a admin panel to enable/disable logging for certain URLs and we would like to do that in runtime, maybe allowing a block in the whitelist/blacklist pattern?

HttpLog.configure do |config|
  config.url_whitelist_pattern = lambda do
    Regexp.union(AdminVendor.pluck(:endpoint).map { Regexp.escape _1 })
  end
end

sobrinho avatar Jan 30 '23 20:01 sobrinho

I'm monkey patching right now to make it work:

class HttpLog::Configuration
  def url_whitelist_pattern
    Regexp.union(AdminVendor.pluck(:endpoint).map { Regexp.escape _1 })
  end
end

But it would to be nice to have it officially :)

sobrinho avatar Jan 30 '23 20:01 sobrinho

Happy to accept a pull request, with tests

trusche avatar May 11 '23 19:05 trusche

Will do!

sobrinho avatar May 11 '23 19:05 sobrinho