Refactor directory creation error handling
This commit is contained in:
parent
6f61db996c
commit
dd78dccab2
1 changed files with 4 additions and 6 deletions
|
@ -85,14 +85,12 @@ class FileLogging implements LogHandlerInterface
|
|||
{
|
||||
$logging_directory = $application->getFileLoggingDirectory();
|
||||
|
||||
if(!is_writable($logging_directory))
|
||||
{
|
||||
throw new RuntimeException(sprintf("Cannot write to %s due to insufficient permissions", $logging_directory));
|
||||
}
|
||||
|
||||
if(!file_exists($logging_directory))
|
||||
{
|
||||
mkdir($logging_directory);
|
||||
if(!mkdir($logging_directory))
|
||||
{
|
||||
throw new RuntimeException(sprintf("Cannot write to %s due to insufficient permissions", $logging_directory));
|
||||
}
|
||||
}
|
||||
|
||||
$logging_file = $logging_directory . DIRECTORY_SEPARATOR . Utilities::sanitizeFileName($application->getApplicationName()) . date('Y-m-d') . '.log';
|
||||
|
|
Loading…
Add table
Reference in a new issue