rjbs/Log-Dispatchouli — pull request #7 by kentfredric (2013-12-30 07:22:37+00:00)
Title: This is my first attempt at providing the feature equivalent of caller_level in Log::Contextual.

1. It allows `Log::Dispatchouli` to have a default caller_level of 1

2. It allows `Log::Dispatchouli` to have the per-instance default
overridden during `->new()`

3. It allows overriding the per-call caller level by passing the
parameter to `->log()`

4. Indirect methods such as log_fatal and log_debug automatically
increment the caller level by 1.

Finally, it only changes `$Carp::CarpLevel` to the most useful/most
available depending on circumstances.

Granted, I have no idea what I am doing, but so far, these basic tests
give the illusion of making `log_fatal` expose a more relevant top stack
frame when called from Log::Contextual

Visible benefits to `Dist::Zilla`
----

Before this patch, calling

```perl
$self->log_fatal("reason");
```

Dies with
```text
[Bootstrap::lib] Bootstrapping lib
[Bootstrap::lib] reason
[Bootstrap::lib] reason at /home/kent/perl5/perlbrew/perls/perl-5.19.6/lib/site_perl/5.19.6/x86_64-linux/Moose/Meta/Method/Delegation.pm line 116.
```

Which is obviously not so useful.

After this patch, the same fails with:

```
[Bootstrap::lib] Bootstrapping lib
[Bootstrap::lib] reason
[Bootstrap::lib] reason at lib/Dist/Zilla/Plugin/Bootstrap/lib.pm line 161.
```

Where line 161 is in fact the line that called log_fatal()