Sha256: 886f9ccc5b708dbd048e046dd3bbec2d8f91f2bd31e97ec6b160f95b719d2a26

Contents?: true

Size: 969 Bytes

Versions: 2

Compression:

Stored size: 969 Bytes

Contents

= each-with-logging

each_with_logging will warn caller, index and length.

    require 'each-with-logging'
    
    [1,2,3,4].each_with_logging {|i|
      p i
    }
    
    # m.rb:3:in `<main>' 1 / 4
    # 1
    # m.rb:3:in `<main>' 2 / 4
    # 2
    # m.rb:3:in `<main>' 3 / 4
    # 3
    # m.rb:3:in `<main>' 4 / 4
    # 4

You can use each_with_logging with Logger.

    require 'each-with-logging'
    require 'logger'
    logger = Logger.new(STDOUT)
    
    [1,2,3,4].each_with_logging(logger) {|i|
      p i
    }
    
    # D, [2011-03-07T10:55:48.014898 #92103] DEBUG -- : l.rb:5:in `<main>' 1 / 4
    # 1
    # D, [2011-03-07T10:55:48.015350 #92103] DEBUG -- : l.rb:5:in `<main>' 2 / 4
    # 2
    # D, [2011-03-07T10:55:48.015722 #92103] DEBUG -- : l.rb:5:in `<main>' 3 / 4
    # 3
    # D, [2011-03-07T10:55:48.015977 #92103] DEBUG -- : l.rb:5:in `<main>' 4 / 4
    # 4



== Copyright

Copyright (c) 2011 hitode909. See LICENSE.txt for
further details.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
each-with-logging-0.1.1 README.rdoc
each-with-logging-0.1.0 README.rdoc