Logging class major change, Debug\Support update

old Debug\Logging is in Debug\LoggingLegacy and Debug\Logging extends
Logging\Logging

Logging\Logging is a new class with most of the functionality except
there is no more print/outout to screen, but we use the default log
levels (RFC5424)
The plan is to be a frontend between the old type class and
Monolog\Monolog

Updated all other classes to use new class interface
This commit is contained in:
Clemens Schwaighofer
2023-05-30 18:12:24 +09:00
parent 7b5ad92e66
commit b0a8783276
75 changed files with 4292 additions and 2019 deletions

View File

@@ -51,25 +51,16 @@ if ($AJAX_PAGE && !$ZIP_STREAM) {
// start session
$session = new \CoreLibs\Create\Session($SET_SESSION_NAME);
// create logger
$log = new \CoreLibs\Debug\Logging([
$log = new \CoreLibs\Logging\Logging([
'log_folder' => BASE . LOG,
'file_id' => $LOG_FILE_ID,
'print_file_date' => true,
'debug_all' => $DEBUG_ALL ?? false,
'echo_all' => $ECHO_ALL ?? false,
'print_all' => $PRINT_ALL ?? false,
'log_file_id' => $LOG_FILE_ID,
// set log level based on host setting
'log_level' => \CoreLibs\Logging\Logging::processLogLevel(DEBUG_LEVEL),
'log_per_date' => true,
]);
// automatic hide for DEBUG messages on live server
// can be overridden when setting DEBUG_ALL_OVERRIDE on top of the script
// (for emergency debugging of one page only)
if (
(TARGET == 'live' || TARGET == 'remote') &&
DEBUG === true &&
!empty($DEBUG_ALL_OVERRIDE)
) {
foreach (['debug', 'echo', 'print'] as $target) {
$log->setLogLevelAll($target, false);
}
// allow override of debug log level settings
if (!empty($DEBUG_ALL_OVERRIDE)) {
$log->setLoggingLevel((string)$DEBUG_ALL_OVERRIDE);
}
// db config with logger
$db = new \CoreLibs\DB\IO(DB_CONFIG, $log);
@@ -130,6 +121,6 @@ if (!$login->loginActionRun()) {
//------------------------------ logging end
// pass on DEBUG flag to JS via smarty variable
$smarty->DATA['JS_DEBUG'] = DEBUG;
$smarty->DATA['JS_DEBUG'] = $log->getJsDebug();
// __END__