aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-08-20 16:34:03 -0300
committerSilvio <silvio@devlet.com.br>2010-08-20 16:34:03 -0300
commitbf67bc20b46f3e464a21ca618e367efa503c6df6 (patch)
tree3c815de6c486eaeeb8d0f2825d49a056826c1564
parent3ee2c153df3633c707da10a159c6104bfbe1c6d6 (diff)
downloadcinisis-bf67bc20b46f3e464a21ca618e367efa503c6df6.tar.gz
cinisis-bf67bc20b46f3e464a21ca618e367efa503c6df6.tar.bz2
Class logger for IsisAudit
-rw-r--r--apps/audit.php8
-rw-r--r--classes/IsisAudit.php22
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.");
}
}
}