[dancer-users] transfer log object

Andrew Beverley andy at andybev.com
Mon Aug 24 08:27:02 BST 2015


On Sun, 2015-08-23 at 20:17 -0400, Arjan Widlak wrote:
> > You don't need to access the log object. In your other object you just do (for
> > example):
> > 
> >      use Log::Report;
> > 
> >      trace "This will be logged as a debug string";
> >      warning "This will be logged as a warning";
> > 
> > The above lines will be logged in exactly the same way as any other logging in
> > your Dancer2 application, as long as you're using the
>> Dancer2::Logger::LogReport logging backend.
>
> I can imagine how this works, within a Dancer2 application. But I'm
> talking about a class that doesn't have a "use Dancer2" statement. Or
> are you saying: just have both applications use Log::Report and
> configure them to log to the same file?

You don't need to do anything in your other object, other than "use Log::Report".
As long as your object was called from within your Dancer2 application (which it
was in your original example), then everything else will Just Work. You don't need
to configure any separate logging; it will use what is already configured in your
parent application.

If it is literally a separate application, executed complete separately from
within the OS, then yes, you would need to configure it twice.




More information about the dancer-users mailing list