Sha256: 99f7ad8babeab73fdf995ecce28ecb854bc08631ec8b3b9d97caff4ddde67b45

Contents?: true

Size: 1.12 KB

Versions: 12

Compression:

Stored size: 1.12 KB

Contents

require File.join(File.dirname(__FILE__), %w[.. setup])

module TestLogging
module TestLayouts

  class TestBasic < Test::Unit::TestCase
    include LoggingTestCase

    def setup
      super
      ::Logging.init
      @layout = ::Logging::Layouts::Basic.new
      @levels = ::Logging::LEVELS
    end

    def test_format
      event = ::Logging::LogEvent.new( 'ArrayLogger', @levels['info'],
                                       'log message', false)
      assert_equal " INFO  ArrayLogger : log message\n", @layout.format(event)

      event.data = [1, 2, 3, 4]
      assert_equal(" INFO  ArrayLogger : <Array> #{[1,2,3,4]}\n",
                   @layout.format(event))

      event.level = @levels['debug']
      event.data = 'and another message'
      log = "DEBUG  ArrayLogger : and another message\n"
      assert_equal log, @layout.format(event)

      event.logger = 'Test'
      event.level = @levels['fatal']
      event.data = Exception.new
      log = "FATAL  Test : <Exception> Exception\n"
      assert_equal log, @layout.format(event)
    end

  end  # class TestBasic

end  # module TestLayouts
end  # module TestLogging

# EOF

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
TwP-logging-0.9.7 test/layouts/test_basic.rb
TwP-logging-0.9.8 test/layouts/test_basic.rb
ottobar-logging-0.9.5.1 test/layouts/test_basic.rb
logging-0.9.2 test/layouts/test_basic.rb
logging-0.9.3 test/layouts/test_basic.rb
logging-0.9.4 test/layouts/test_basic.rb
logging-0.9.6 test/layouts/test_basic.rb
logging-0.9.7 test/layouts/test_basic.rb
logging-0.9.5 test/layouts/test_basic.rb
logging-0.9.0 test/layouts/test_basic.rb
logging-0.9.1 test/layouts/test_basic.rb
logging-0.9.8 test/layouts/test_basic.rb