Sha256: 678f730548b0051b95fe4374b9f30b3a75195f9e000a598ed2667b3bc863956d

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

require 'soar_auditor_api'

class SanityAuditor < SoarAuditorApi::AuditorAPI
  def configuration_is_valid?(configuration)
    return configuration.include?("preprefix")
  end

  def audit(data)
    puts @configuration["preprefix"] + data
  end
end

class TestSerializable < SoarAuditorApi::Serializable
  def to_s
    serialize
  end
end

class Main
  def test_sanity
    @iut = SanityAuditor.new
    configuration = { "preprefix" => "very important:" }
    @iut.configure(configuration)
    @iut.set_audit_level(:debug)

    some_debug_object = 123
    @iut.info("This is info")
    @iut.debug(some_debug_object)
    dropped = 95
    @iut.warn("Statistics show that dropped packets have increased to #{dropped}%")
    @iut.error("Could not resend some dropped packets. They have been lost. All is still OK, I could compensate")
    @iut.fatal("Unable to perform action, too many dropped packets. Functional degradation.")
    @iut << 'Rack::CommonLogger requires this'

    serializable_object = TestSerializable.new("some data")
    puts serializable_object.to_s

  end
end

main = Main.new
main.test_sanity

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
soar_auditor_api-1.0.0 sanity/sanity.rb
soar_auditor_api-0.0.12 sanity/sanity.rb
soar_auditor_api-0.0.11 sanity/sanity.rb
soar_auditor_api-0.0.10 sanity/sanity.rb