Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Commit

Permalink
Handle array/object arguments in logging calls
Browse files Browse the repository at this point in the history
  • Loading branch information
csmith committed Jul 12, 2010
1 parent 5b8b227 commit f2195c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion discoverer.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ protected function handleRedirects($details) {
if (strpos($m[1], '://') !== false) {
// Fully qualified URL
$this->claimedId = $m[1];
Logger::log('Redirection (full qualified) to ' . $m[1]);
Logger::log('Redirection (fully qualified) to ' . $m[1]);
} else if ($m[1][0] == '/') {
// Absolute URL
$this->claimedId = preg_replace('#^(.*?://.*?)/.*$#', '\1', $this->claimedId) . $m[1];
Expand Down
6 changes: 6 additions & 0 deletions logging.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ protected static function getCaller() {
}

protected static function formatArg(&$value, $key) {
if (is_array($value)) {
$value = '[' . implode(',', $value) . ']';
} else if (is_object($value)) {
$value = '(object: ' . get_class($value) . ')';
}

if (strlen($value) > 30 && self::TRUNCATE_ARGS) {
$value = substr($value, 0, 27) . '...';
}
Expand Down

0 comments on commit f2195c7

Please sign in to comment.