1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-24 18:16:10 +02:00

Added the support of a logging context

This commit is contained in:
Christophe Coevoet
2011-06-01 00:10:38 +02:00
parent a8d4fc4a34
commit c1675c59d8
13 changed files with 74 additions and 60 deletions

View File

@@ -36,7 +36,7 @@ abstract class AbstractProcessingHandler extends AbstractHandler
$record = $this->processRecord($record);
$record['message'] = $this->getFormatter()->format($record);
$record['formatted'] = $this->getFormatter()->format($record);
$this->write($record);

View File

@@ -79,7 +79,7 @@ class FirePHPHandler extends AbstractProcessingHandler
// but we're not taking advantage of that (yet), so we're using "1" for simplicity's sake.
return $this->createHeader(
array(1, 1, 1, self::$messageIndex++),
$record['message']
$record['formatted']
);
}

View File

@@ -33,7 +33,7 @@ abstract class MailHandler extends AbstractProcessingHandler
}
if (!empty($messages)) {
$this->send($this->getFormatter()->formatBatch($messages));
$this->send((string) $this->getFormatter()->formatBatch($messages));
}
}
@@ -49,8 +49,6 @@ abstract class MailHandler extends AbstractProcessingHandler
*/
protected function write(array $record)
{
$content = $record['message'];
$this->send($content);
$this->send((string) $record['formatted']);
}
}

View File

@@ -67,6 +67,6 @@ class StreamHandler extends AbstractProcessingHandler
throw new \UnexpectedValueException(sprintf('The stream or file "%s" could not be opened; it may be invalid or not writable.', $this->url));
}
}
fwrite($this->stream, (string) $record['message']);
fwrite($this->stream, (string) $record['formatted']);
}
}

View File

@@ -104,6 +104,6 @@ class SyslogHandler extends AbstractProcessingHandler
*/
protected function write(array $record)
{
syslog($this->logLevels[$record['level']], (string) $record['message']);
syslog($this->logLevels[$record['level']], (string) $record['formatted']);
}
}