logs dir in config & mkdir if not exist
This commit is contained in:
parent
d2906509ee
commit
cda2cf8f3c
2 changed files with 7 additions and 3 deletions
|
@ -3,8 +3,6 @@ defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
|||
|
||||
class Log
|
||||
{
|
||||
const PATH = 'data/logs/';
|
||||
|
||||
private static $_files = [
|
||||
"ajax_access",
|
||||
"ajax_errors",
|
||||
|
@ -17,7 +15,12 @@ class Log
|
|||
return ;
|
||||
}
|
||||
|
||||
if(false === file_put_contents(PROJECT_PATH.static::PATH.$_file.".log", self::line($_text), FILE_APPEND) && Config::get_safe('debug', false)){
|
||||
$_logs_path = Config::get('logs_path');
|
||||
if(!is_dir($_logs_path) && !mkdir($_logs_path, 755, true)){
|
||||
die("Logs directory could not be created.");
|
||||
}
|
||||
|
||||
if(false === file_put_contents($_logs_path.$_file.".log", self::line($_text), FILE_APPEND) && Config::get_safe('debug', false)){
|
||||
die(sprintf("Can't write to %s.log file.", $_file));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ pass = demo
|
|||
[directories]
|
||||
images_path = i/
|
||||
thumbnails_path = t/
|
||||
logs_path = data/logs/
|
||||
|
||||
[system]
|
||||
system_name = blog
|
||||
|
|
Loading…
Add table
Reference in a new issue