Hi,

1) define a $log in the main app (and add a helper if required) so that all 
controllers access this single Mojo::Log instance
2) See the Mojo::Log#format method 
(http://mojolicio.us/perldoc/Mojo/Log#format)

Hope that helps.

Allan

On Tuesday, 14 October 2014 08:36:48 UTC-5, somepad wrote:
>
> Hi all,
>
> So far I'm using Mojolicious for my application.
> Right now I have many constrollers within many files.
> On top of each file before the first controller I have this line:
>
> my $log = Mojo::Log->new(path => '../log/app.log', level => 'debug');
>
> So I can call $log->level() from controllers.
>
> 1. Can I place $log definition somewhere in App.pm file (which contains 
> startup {} sub) and use this $log instead of defining $log into each 
> controller file? (Define global $log or something like this...)
> 2. Can I change log format for this $log? I have a helper which returns 
> client info (ip, id, etc) so I want in to be in logs. I can call $log like 
> this:
>
> $log->level($self->GetClient.'message');
>
> But probably I could call just $log->level('message') and log formatter 
> might do rest?
>

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to