1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-03 11:47:38 +02:00

Fix constructor handling of arrays

This commit is contained in:
Jordi Boggiano
2011-02-17 03:16:20 +01:00
parent 2ff85ba472
commit 9d8c84d6cd
2 changed files with 8 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ class Log
{ {
$this->name = $name; $this->name = $name;
$this->level = $level; $this->level = $level;
$this->writers = (array) $writers; $this->writers = is_array($writers) ? $writers : array($writers);
} }
public function getName() public function getName()

View File

@@ -31,7 +31,13 @@ class Logger
public function __construct($logs = array()) 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) public function addLog(Log $log)