Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_log returns the class instance for method chaining #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions ChromePhp.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,33 +245,31 @@ public static function table()
* internal logging call
*
* @param string $type
* @return void
* @return ChromePhp
*/
protected static function _log($type, array $args)
{
$logger = self::getInstance();

// nothing passed in, don't do anything
if (count($args) == 0 && $type != self::GROUP_END) {
return;
if (empty($args) && $type != self::GROUP_END) {
return $logger;
}

$logger = self::getInstance();

$logger->_processed = array();

$logs = array();
foreach ($args as $arg) {
$logs[] = $logger->_convert($arg);
}
$logs = array_map(array($logger, '_convert'), $args);

$backtrace = debug_backtrace(false);
$level = $logger->getSetting(self::BACKTRACE_LEVEL);

$backtrace_message = 'unknown';
if (isset($backtrace[$level]['file']) && isset($backtrace[$level]['line'])) {
if (isset($backtrace[$level]['file'], $backtrace[$level]['line'])) {
$backtrace_message = $backtrace[$level]['file'] . ' : ' . $backtrace[$level]['line'];
}

$logger->_addRow($logs, $backtrace_message, $type);

return $logger;
}

/**
Expand Down