-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laravel 5.6 #2
Comments
You can use https://github.com/Gilg4mesh/monolog-mysql along with the new way of registering loggers in Laravel 5.6: config/logging.php<?php
// [...]
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['mysql'],
],
// [...]
'mysql' => [
'driver' => 'custom',
'via' => App\Logging\CreateMySQLLogger::class,
],
], app/Logging/CreateMySQLLogger.php<?php
namespace App\Logging;
use Exception;
use Monolog\Logger;
use Logger\Monolog\Handler\MysqlHandler;
class CreateMySQLLogger
{
/**
* Create a custom Monolog instance.
*
* @param array $config
* @return Logger
* @throws Exception
*/
public function __invoke(array $config)
{
$channel = $config['name'] ?? env('APP_ENV');
$monolog = new Logger($channel);
$monolog->pushHandler(new MysqlHandler());
return $monolog;
}
} Further reading: https://blog.bugsnag.com/laravel-5-6/ |
@ilumos you saved my date! |
This was referenced Sep 27, 2018
Here's an even simpler way of doing it with laravel and lumen from version 5.6 up to 7.x
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when will be supported for laravel 5.6
I tried to install and gave error
The text was updated successfully, but these errors were encountered: