Excellent!  I'm not finding there to be any difference, either.  Thank you
for the reply!

As precise as the documentation is, I thought I would check to make sure
there wasn't a good reason for it.

The documentation shows that the controller log helper can be passed to a
model in this way...  Rather than passing the log helper to *each* method
as shown in the documentation, could we store it in the model object so
that all methods would be able to use it and not need to have the log
helper called explicitly each time?

Here's an example gist
<https://gist.github.com/s1037989/8993ddb90778befb51a4f334087a97ca>.

On Thu, Apr 9, 2020 at 5:59 PM Dan Book <[email protected]> wrote:

> I don't believe there would be any difference.
>
> -Dan
>
> On Thu, Apr 9, 2020 at 6:13 PM Stefan Adams <[email protected]> wrote:
>
>> In Mojolicious::Plugin::DefaultHelpers#og
>> <https://mojolicious.org/perldoc/Mojolicious/Plugin/DefaultHelpers#log>
>>
>> I suspect there is a good, fundamental reason behind this decision in the
>> documents, but I'm not sure what it is.
>>
>> Why is $log passed to the model method
>>
>> # Pass logger with context to modelmy $log = $c->log;
>> $c->some_model->create({foo => $foo}, $log);
>>
>>
>> Instead of $c->log
>>
>> # Pass logger with context to model
>> $c->some_model->create({foo => $foo}, $c->log);
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Mojolicious" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/mojolicious/CACyQ%2BFTSncQ%3D2ff9wf5Q6wOOH0RQp96-LPMbNyv2sGoJNri1eg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/mojolicious/CACyQ%2BFTSncQ%3D2ff9wf5Q6wOOH0RQp96-LPMbNyv2sGoJNri1eg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mojolicious/CABMkAVV%2BOE7OERWzmc0-h7OhobvAteKqVAhWQJkK1kxyQY8ZqA%40mail.gmail.com
> <https://groups.google.com/d/msgid/mojolicious/CABMkAVV%2BOE7OERWzmc0-h7OhobvAteKqVAhWQJkK1kxyQY8ZqA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/CACyQ%2BFTpazf5vzBE7wVr0tadTt%3DxXKTCBN5NvWMRFJv4Wi46Dg%40mail.gmail.com.

Reply via email to