|
...
|
...
|
@@ -32,8 +32,22 @@ class LogFormatterFactory |
|
|
|
$path = date('Y-m', $time) . '/' . date('d', $time) . '_' . $suffix . '.log';
|
|
|
|
$path = 'logs/' . $config['prefix'] . '/' . $path;
|
|
|
|
$path = storage_path($path);
|
|
|
|
|
|
|
|
try {
|
|
|
|
if (!file_exists($path)) {
|
|
|
|
$directory = pathinfo($path, PATHINFO_DIRNAME);
|
|
|
|
if(!file_exists($directory)){
|
|
|
|
mkdir($directory, 0644, true);
|
|
|
|
chown($directory, 'www');
|
|
|
|
}
|
|
|
|
touch($path);
|
|
|
|
chown($path, 'www');
|
|
|
|
}
|
|
|
|
}catch (\Throwable $exception){}
|
|
|
|
|
|
|
|
$handler = new StreamHandler($path, $level, false);
|
|
|
|
$handler->setFormatter(new LineFormatter(null, 'Y-m-d H:i:s', false, true));
|
|
|
|
|
|
|
|
return $handler;
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|