jordansissel/ruby-cabin — Issue #1: #Channel.time could allow mid-block logs emitting so-far-duration
Author: jordansissel
Created: 2011-11-04 09:44:24+00:00
State: open

This is nice:

logger.time("Doing stuff") do
do_something
end

But this would be better -

logger.time("Doing stuff") do
logger.info("foo")
do_something1
logger.info("bar")
do_something2
end

In the above example, logger.info("foo") while nested in a 'time' block should emit something like:

{ "message": "foo", "parent": "Doing stuff", "duration": 0.124 }
{ "message": "bar", "parent": "Doing stuff", "duration": 0.547 }

Or something like that, basically maintaining "we are in a timer block" ? Maybe not 'parent' but something like it.