[dancer-users] transfer log object

Andrew Beverley andy at andybev.com
Sun Aug 23 23:03:00 BST 2015

On Sun, 2015-08-23 at 13:09 -0400, Arjan Widlak wrote:
> > That way everything in your application will write to the same logger, which
> > can also be written to in any other application/backend, just by using
> > Log::Report.
> Thanx for your reply. I've just read the documentation and I can see the
> use of the plugin. However I would have the same question: how can I 
> access the log object and pass a reference to another object? (outside 
> of a route)

You don't need to access the log object. In your other object you just do (for

    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.


More information about the dancer-users mailing list