diff options
-rw-r--r-- | apps/audit.php | 8 | ||||
-rw-r--r-- | classes/IsisAudit.php | 22 |
2 files changed, 24 insertions, 6 deletions
diff --git a/apps/audit.php b/apps/audit.php index 9863e2d..0bd560b 100644 --- a/apps/audit.php +++ b/apps/audit.php @@ -15,10 +15,12 @@ $isis = new IsisAudit(); // Setup database and entry number. if ($isis) { // Run audit. - $result = $isis->run(); + $isis->run(); - // Format output. - $display->pre(print_r($result)); + // Display log messages. + foreach ($isis->log as $message) { + $display->pre(print_r($message)); + } } $display->footer(); diff --git a/classes/IsisAudit.php b/classes/IsisAudit.php index 63446e1..f2435a9 100644 --- a/classes/IsisAudit.php +++ b/classes/IsisAudit.php @@ -5,6 +5,22 @@ */ class IsisAudit extends IsisFinder { /** + * @var $log + * Log messages. + */ + var $log; + + /** + * Class logger. + * + * @param $message + * Log message. + */ + function logger($message) { + $this->log[] = $message; + } + + /** * Run a standard audit procedure. */ public function run() { @@ -13,10 +29,10 @@ class IsisAudit extends IsisFinder { // Check for repetitions. if ($field['repeat'] && !$repetition) { - echo "Field ". $field['name'] ." is configured for repetitions but no repetitions found.\n"; + $this->logger("Field ". $field['name'] ." is configured for repetitions but no repetitions found."); } elseif (!$field['repeat'] && $repetition) { - echo "Field ". $field['name'] ." is not configured for repetitions but a repetition was found for entry ". $repetition[0] .".\n"; + $this->logger("Field ". $field['name'] ." is not configured for repetitions but a repetition was found for entry ". $repetition[0] ."."); } // Check for subfields. @@ -25,7 +41,7 @@ class IsisAudit extends IsisFinder { $next_subfield = $this->nextSubfield($field, $subfield); if (!$next_subfield) { - echo "No occurrences found for field ". $field['name'] ." and subfield $subfield\n"; + $this->logger("No occurrences found for field ". $field['name'] ." and subfield $subfield."); } } } |