[dancer-users] transfer log object

Arjan Widlak arjan at unitedknowledge.nl
Mon Aug 24 01:39:29 BST 2015


Perhaps I should rephrase the question. Suppose Dancer2 would not export 
all these keywords, how would I get a reference to the logger - or any 
other - object? (outside of a route)

On 23-08-15 20:17, Arjan Widlak wrote:
> Dear Andy,
>
> 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?
>
> Kind regards,
> Arjan
>
> On 23-08-15 18:03, Andrew Beverley wrote:
>> 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
>> 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.
>>
>> Andy
>>
>>
>> _______________________________________________
>> dancer-users mailing list
>> dancer-users at dancer.pm
>> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users



More information about the dancer-users mailing list