Module: SafePgMigrations::Helpers::Logger

Defined in:
lib/safe-pg-migrations/helpers/logger.rb

Class Method Summary collapse

Class Method Details

.say(message, sub_item: false, sensitive: false, warn_sensitive_logs: true) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/safe-pg-migrations/helpers/logger.rb', line 7

def say(message, sub_item: false, sensitive: false, warn_sensitive_logs: true)
  return unless SafePgMigrations.current_migration

  if sensitive
    log_sensitive message, sub_item: sub_item
    if warn_sensitive_logs && sensitive_logger?
      log 'Sensitive data sent to sensitive logger', sub_item: sub_item
    end
  else
    log message, sub_item: sub_item
  end
end

.say_method_call(method, *args, sensitive: false, warn_sensitive_logs: true, **options) ⇒ Object



20
21
22
23
24
25
# File 'lib/safe-pg-migrations/helpers/logger.rb', line 20

def say_method_call(method, *args, sensitive: false, warn_sensitive_logs: true, **options)
  args += [options] unless options.empty?

  say "#{method}(#{args.map(&:inspect) * ', '})",
      sub_item: true, sensitive: sensitive, warn_sensitive_logs: warn_sensitive_logs
end