function testLogs($mode = true) { $loadedModules = self::$_settings->general['modules']; $logdir = HOME_PATH . '/' . self::$_settings->general['settings']['logs_dir']; $test_worked = false; $test_nested = false; if (LoadUtility::is_dir_empty($logdir)) { return false; } // Check for each module we have loadedModules foreach ($loadedModules as $module => $value) { if ($value == "false" || !isset(LoadModules::$_settings->{$module})) { continue; } $moduleSettings = LoadModules::$_settings->{$module}; // Check if loadedModules module needs loggable capabilities if ($moduleSettings['module']['logable'] == "true") { foreach ($moduleSettings['logging']['args'] as $args) { $args = json_decode($args); $class = LoadModules::$_classes[$module]; $caller = $args->function; //skip network interfaces as they have nested logs and work differently //later need to skip all nested logs as we check those below if ($args->logfile == "network_%s_%s.log") { $test_nested = true; } else { $filename = $logdir . sprintf($args->logfile, date('Y-m-d')); if (file_exists($filename)) { $test_worked = true; } if ($mode == true) { echo "Log: {$filename} Status: {$test_worked} \n"; } } } } } if ($test_nested == true) { //now do nested charts foreach (LoadAvg::$_settings->general['network_interface'] as $interface => $value) { if (!(isset(LoadAvg::$_settings->general['network_interface'][$interface]) && LoadAvg::$_settings->general['network_interface'][$interface] == "true")) { continue; } $filename = $logdir . sprintf($args->logfile, date('Y-m-d'), $interface); if (file_exists($filename)) { $test_worked = true; } if ($mode == true) { echo "Log: {$filename} Status: {$test_worked} \n"; } } } return $test_worked; }