datatable.directory codebase
https://datatable.directory/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
735 B
23 lines
735 B
7 years ago
|
<?php
|
||
|
|
||
|
namespace App;
|
||
|
|
||
|
use Monolog\Logger as MonologLogger;
|
||
|
|
||
|
/**
|
||
|
* Custom logger to solve the log permissions nightmare
|
||
|
*/
|
||
|
class Logger {
|
||
|
public function __invoke(array $config)
|
||
|
{
|
||
|
$monolog = new MonologLogger('my-logger');
|
||
|
$filename = storage_path('logs/' . php_sapi_name() . '-' . posix_getpwuid(posix_geteuid())['name'] . '.log');
|
||
|
$monolog->pushHandler($handler = new \Monolog\Handler\RotatingFileHandler($filename, 30));
|
||
|
$handler->setFilenameFormat('laravel-{date}-{filename}', 'Y-m-d');
|
||
|
$formatter = new \Monolog\Formatter\LineFormatter(null, null, true, true);
|
||
|
$formatter->includeStacktraces();
|
||
|
$handler->setFormatter($formatter);
|
||
|
return $monolog;
|
||
|
}
|
||
|
}
|