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

Commit

Permalink
Merge branch 'hotfix/log-firephp'
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/Writer/FirePhp.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class FirePhp extends AbstractWriter
{
/**
* The instance of FirePhp that is used to log messages to.
* A FirePhpInterface instance that is used to log messages to.
*
* @var FirePhp\FirePhpInterface
*/
Expand All @@ -48,7 +48,9 @@ public function __construct(FirePhp\FirePhpInterface $instance = null)
*/
protected function doWrite(array $event)
{
if (!$this->firephp->getEnabled()) {
$firephp = $this->getFirePhp();

if (!$firephp->getEnabled()) {
return;
}

Expand All @@ -59,26 +61,26 @@ protected function doWrite(array $event)
case Logger::ALERT:
case Logger::CRIT:
case Logger::ERR:
$this->firephp->error($line);
$firephp->error($line);
break;
case Logger::WARN:
$this->firephp->warn($line);
$firephp->warn($line);
break;
case Logger::NOTICE:
case Logger::INFO:
$this->firephp->info($line);
$firephp->info($line);
break;
case Logger::DEBUG:
$this->firephp->trace($line);
$firephp->trace($line);
break;
default:
$this->firephp->log($line);
$firephp->log($line);
break;
}
}

/**
* Gets the FirePhp instance that is used for logging.
* Gets the FirePhpInterface instance that is used for logging.
*
* @return FirePhp\FirePhpInterface
*/
Expand All @@ -97,9 +99,9 @@ public function getFirePhp()
}

/**
* Sets the FirePhp instance that is used for logging.
* Sets the FirePhpInterface instance that is used for logging.
*
* @param FirePhp\FirePhpInterface $instance The FirePhp instance to set.
* @param FirePhp\FirePhpInterface $instance A FirePhpInterface instance to set.
* @return FirePhp
*/
public function setFirePhp(FirePhp\FirePhpInterface $instance)
Expand Down
1 change: 1 addition & 0 deletions src/Writer/FirePhp/FirePhpBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class FirePhpBridge implements FirePhpInterface
{
/**
* FirePHP instance
*
* @var FirePHP
*/
protected $firephp;
Expand Down
35 changes: 35 additions & 0 deletions src/Writer/FirePhp/FirePhpInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,45 @@
*/
interface FirePhpInterface
{
/**
* Determine whether or not FirePHP is enabled
*
* @return bool
*/
public function getEnabled();

/**
* Log an error message
*
* @param string $line
*/
public function error($line);

/**
* Log a warning
*
* @param string $line
*/
public function warn($line);

/**
* Log informational message
*
* @param string $line
*/
public function info($line);

/**
* Log a trace
*
* @param string $line
*/
public function trace($line);

/**
* Log a message
*
* @param string $line
*/
public function log($line);
}

0 comments on commit f1dd38a

Please sign in to comment.