Reputation: 3437
I'm quite new to laravel 4
, and I want to log to files inside storage/logs
when a user
attempt to connect to my application.
I have added inside routes.php
this:
Event::listen('auth.attempt', function() {
echo 'attempting to logging in';
});
I know that Laravel 4
includes monolog
which is a PHP logging framework , but I dont know if it's the easiest way to log here.
I can declare a filter
that I add to the before
of my route
, but this solution isn't very elegant.
Upvotes: 1
Views: 4714
Reputation: 7586
Go with monolog, it is widely used and a great library. It can be configured in many different ways and implements the PSR-3 logging interface. See http://laravel.com/docs/errors#logging and http://github.com/Seldaek/monolog.
Most simple logging command:
Log::info('This is some useful information.');
If you want to directly interface with monolog:
$monolog = Log::getMonolog();
By using the standard laravel facade for monolog it will automatically log it into a new file with the current date.
Regarding your initial query about the easiest method, I feel compelled to say this is the easiest one.
Upvotes: 6