Sha256: 18d731e271cfd6aa951fc31965b525d6bd38851cf41e0c196fe9596c4ac1fad0

Contents?: true

Size: 1.09 KB

Versions: 31

Compression:

Stored size: 1.09 KB

Contents

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

module TestLogging
module TestLayouts

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

    def setup
      super
      @layout = Logging.layouts.basic({})
      @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

31 entries across 31 versions & 5 rubygems

Version Path
TwP-logging-0.9.8.1 test/layouts/test_basic.rb
TwP-logging-0.9.8.2 test/layouts/test_basic.rb
TwP-logging-1.0.0 test/layouts/test_basic.rb
TwP-logging-1.1.0 test/layouts/test_basic.rb
TwP-logging-1.1.1 test/layouts/test_basic.rb
TwP-logging-1.1.2 test/layouts/test_basic.rb
TwP-logging-1.1.3 test/layouts/test_basic.rb
TwP-logging-1.1.4 test/layouts/test_basic.rb
TwP-logging-1.2.0 test/layouts/test_basic.rb
TwP-logging-1.2.2 test/layouts/test_basic.rb
pjstadig-logging-1.1.4.1 test/layouts/test_basic.rb
logging-1.4.3 test/layouts/test_basic.rb
sgeorgi-logging-1.4.2 test/layouts/test_basic.rb
logging-1.4.2 test/layouts/test_basic.rb
logging-1.4.1 test/layouts/test_basic.rb
logging-1.4.0 test/layouts/test_basic.rb
redcar-0.3.1dev lib/logging/test/layouts/test_basic.rb
redcar-0.3.0dev lib/logging/test/layouts/test_basic.rb
logging-1.3.0 test/layouts/test_basic.rb
redcar-0.2.9dev lib/logging/test/layouts/test_basic.rb