Class: Blouson::SensitiveTableQueryLogSilencer

Inherits:
Arproxy::Base
  • Object
show all
Defined in:
lib/blouson/sensitive_table_query_log_silencer.rb

Instance Method Summary collapse

Instance Method Details

#execute(sql, name = nil, **kwargs) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/blouson/sensitive_table_query_log_silencer.rb', line 3

def execute(sql, name=nil, **kwargs)
  if !Rails.logger.debug? || !(Blouson::SENSITIVE_TABLE_REGEXP === sql)
    return super(sql, name, **kwargs)
  end

  ActiveRecord::Base.logger.silence(Logger::INFO) do
    Rails.logger.info "  [Blouson::SensitiveTableQueryLogSilencer] SQL Log is skipped for sensitive table"
    super(sql, name, **kwargs)
  end
end