Log: try to properly handle log message before initialization

This commit is contained in:
Benjamin Renard 2023-03-03 10:37:56 +01:00
parent e27c009be8
commit 6faff353d3
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -161,6 +161,12 @@ class Log {
); );
$level = 'WARNING'; $level = 'WARNING';
} }
if (!self :: $level)
self :: $level = (
App::initialized()?
App::get('log.level', 'WARNING', 'string'):
'WARNING'
);
if (self :: $levels[$level] < self :: $levels[self :: $level]) return true; if (self :: $levels[$level] < self :: $levels[self :: $level]) return true;
if(self :: $filepath && is_null(self :: $file_fd)) { if(self :: $filepath && is_null(self :: $file_fd)) {
self :: $file_fd = fopen(self :: $filepath, 'a'); self :: $file_fd = fopen(self :: $filepath, 'a');