No commit activity in last 3 years
No release in over 3 years
each with logging gem.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.5.2
>= 0
~> 2.3.0
 Project Readme

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 © 2011 hitode909. See LICENSE.txt for further details.