From: Roland Häder Date: Sun, 17 Jan 2021 04:22:28 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=899c742fa8d4807a3e2d9c7f4bd2a3acab85e6b6;p=core.git Continued: - better debug logging Signed-off-by: Roland Häder --- diff --git a/framework/main/classes/class_BaseFrameworkSystem.php b/framework/main/classes/class_BaseFrameworkSystem.php index c0728aae..77cc954d 100644 --- a/framework/main/classes/class_BaseFrameworkSystem.php +++ b/framework/main/classes/class_BaseFrameworkSystem.php @@ -1018,10 +1018,8 @@ Loaded includes: * @return $isset Whether the given key is set */ protected final function isGenericArrayElementSet (string $keyGroup, string $subGroup, $key, $element) { - // Debug message - //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element); - // Is it there? + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key . ',element=' . $element); $isset = isset($this->genericArray[$keyGroup][$subGroup][$key][$element]); // Return it @@ -1036,10 +1034,8 @@ Loaded includes: * @return $isset Whether the given key is set */ protected final function isGenericArrayKeySet (string $keyGroup, string $subGroup, $key) { - // Debug message - //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); - // Is it there? + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); $isset = isset($this->genericArray[$keyGroup][$subGroup][$key]); // Return it @@ -1055,10 +1051,8 @@ Loaded includes: * @return $isset Whether the given group is set */ protected final function isGenericArrayGroupSet (string $keyGroup, string $subGroup) { - // Debug message - //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup); - // Is it there? + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup); $isset = isset($this->genericArray[$keyGroup][$subGroup]); // Return it @@ -1080,10 +1074,8 @@ Loaded includes: exit; } - // Debug message - //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',value=' . print_r($this->genericArray[$keyGroup][$subGroup], true)); - // Return it + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',value=' . print_r($this->genericArray[$keyGroup][$subGroup], true)); return $this->genericArray[$keyGroup][$subGroup]; } @@ -1096,10 +1088,8 @@ Loaded includes: * @return void */ protected final function unsetGenericArrayKey (string $keyGroup, string $subGroup, $key) { - // Debug message - //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); - // Remove it + //* NOISY-DEBUG: */ $this->outputLine('[' . __METHOD__ . ':' . __LINE__ . '] keyGroup=' . $keyGroup . ',subGroup=' . $subGroup . ',key=' . $key); unset($this->genericArray[$keyGroup][$subGroup][$key]); } diff --git a/framework/main/classes/index/file/class_BaseFileIndex.php b/framework/main/classes/index/file/class_BaseFileIndex.php index 16655594..6a9169bc 100644 --- a/framework/main/classes/index/file/class_BaseFileIndex.php +++ b/framework/main/classes/index/file/class_BaseFileIndex.php @@ -111,7 +111,7 @@ abstract class BaseFileIndex extends BaseIndex implements FileIndexer { $header = explode(chr(BinaryFile::SEPARATOR_HEADER_DATA), $data); // Map numeric entries to associative (alpha-numeric) elements - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-INDEX: HEADER_INDEX_ELEMENT_COUNT=%d,header()=%d', BinaryFile::HEADER_INDEX_ELEMENT_COUNT, count($header))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-INDEX: Calling ArrayUtils::mapNumericKeysToAssociative(%d) ...', count($header))); //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-INDEX: header(%d)=%s', count($header), print_r($header, true))); $header = ArrayUtils::mapNumericKeysToAssociative($header, [ BinaryFile::HEADER_NAME_MAGIC, @@ -119,6 +119,7 @@ abstract class BaseFileIndex extends BaseIndex implements FileIndexer { ]); // Check if the array has only 2 elements + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-INDEX: HEADER_INDEX_ELEMENT_COUNT=%d,header()=%d', BinaryFile::HEADER_INDEX_ELEMENT_COUNT, count($header))); if (count($header) != BinaryFile::HEADER_INDEX_ELEMENT_COUNT) { // Bad header throw new UnexpectedValueException(sprintf('header()=%d is not expected value %d', count($header), BinaryFile::HEADER_INDEX_ELEMENT_COUNT)); diff --git a/framework/main/classes/stacker/file/class_BaseFileStack.php b/framework/main/classes/stacker/file/class_BaseFileStack.php index abb9c5e7..f904afb5 100644 --- a/framework/main/classes/stacker/file/class_BaseFileStack.php +++ b/framework/main/classes/stacker/file/class_BaseFileStack.php @@ -101,12 +101,12 @@ abstract class BaseFileStack extends BaseStacker { } // Last character must be the separator - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: data(-1)=%s', dechex(ord(substr($data, -1, 1))))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: data(-1)=0x%s', dechex(ord(substr($data, -1, 1))))); if (substr($data, -1, 1) !== chr(BinaryFile::SEPARATOR_HEADER_ENTRIES)) { // Not valid separator - throw new UnexpectedValueException(sprintf('data=%s does not have separator=%s at the end.', + throw new UnexpectedValueException(sprintf('data=%s does not have separator=0x%s at the end.', $data, - BinaryFile::SEPARATOR_HEADER_ENTRIES + dechex(BinaryFile::SEPARATOR_HEADER_ENTRIES) )); } @@ -127,7 +127,7 @@ abstract class BaseFileStack extends BaseStacker { $header = explode(chr(BinaryFile::SEPARATOR_HEADER_DATA), $data); // Map numeric indexes to associative indexes - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: header()=%d', count($header))); + /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-FILE-STACK: Calling ArrayUtils::mapNumericKeysToAssociative(%d) ...', count($header))); $header = ArrayUtils::mapNumericKeysToAssociative($header, [ BinaryFile::HEADER_NAME_MAGIC, BinaryFile::HEADER_NAME_TOTAL_ENTRIES,