Sha256: 510b74b2efe6702d053bb44842c869cab10ae1e7d70324ca245b41fcb0b89390

Contents?: true

Size: 684 Bytes

Versions: 13

Compression:

Stored size: 684 Bytes

Contents

require 'logger'

module SurveyGizmo
  class Logger < ::Logger
    def format_message(severity, timestamp, progname, message)
      if (api_token = SurveyGizmo.configuration.api_token)
        message.gsub!(
          /#{Regexp.quote(api_token)}|#{Regexp.quote(CGI.escape(api_token))}/,
          '<SG_API_KEY>'
        )
      end

      if (api_token_secret = SurveyGizmo.configuration.api_token_secret)
        message.gsub!(
          /#{Regexp.quote(api_token_secret)}|#{Regexp.quote(CGI.escape(api_token_secret))}/,
          '<SG_API_SECRET>'
        )
      end

      "[#{timestamp.strftime('%Y-%m-%d %H:%M:%S')} #{severity} (#{Process.pid})] #{message}\n"
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
survey-gizmo-ruby-8.0.0 lib/survey_gizmo/logger.rb
survey-gizmo-ruby-7.1.1 lib/survey_gizmo/logger.rb
survey-gizmo-ruby-7.1.0 lib/survey_gizmo/logger.rb
survey-gizmo-ruby-7.0.0 lib/survey_gizmo/logger.rb
survey-gizmo-ruby-6.7.0 lib/survey_gizmo/logger.rb
survey-gizmo-ruby-6.6.0 lib/survey_gizmo/logger.rb
survey-gizmo-ruby-6.5.1 lib/survey_gizmo/logger.rb
survey-gizmo-ruby-6.5.0 lib/survey_gizmo/logger.rb
survey-gizmo-ruby-6.4.1 lib/survey_gizmo/logger.rb
survey-gizmo-ruby-6.4.0 lib/survey_gizmo/logger.rb
survey-gizmo-ruby-6.3.2 lib/survey_gizmo/logger.rb
survey-gizmo-ruby-6.3.1 lib/survey_gizmo/logger.rb
survey-gizmo-ruby-6.3.0 lib/survey_gizmo/logger.rb