Skip to content

Commit

Permalink
Fix constructor handling of arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Feb 17, 2011
1 parent 2ff85ba commit 9d8c84d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Monolog/Log.php
Expand Up @@ -23,7 +23,7 @@ public function __construct($name, $level = Logger::WARN, $writers = array())
{
$this->name = $name;
$this->level = $level;
$this->writers = (array) $writers;
$this->writers = is_array($writers) ? $writers : array($writers);
}

public function getName()
Expand Down
8 changes: 7 additions & 1 deletion src/Monolog/Logger.php
Expand Up @@ -31,7 +31,13 @@ class Logger

public function __construct($logs = array())
{
$this->logs = (array) $logs;
$this->logs = array();
if (!is_array($logs)) {
$logs = array($logs);
}
foreach ($logs as $log) {
$this->logs[$log->getName()] = $log;
}
}

public function addLog(Log $log)
Expand Down

0 comments on commit 9d8c84d

Please sign in to comment.