1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-23 09:36:11 +02:00

Add logging of exception line and file path to gelf message

This commit is contained in:
Tarjei Huse
2013-10-27 08:29:08 +01:00
parent c600461b0f
commit b78d997638
2 changed files with 36 additions and 0 deletions

View File

@@ -89,6 +89,13 @@ class GelfMessageFormatter extends NormalizerFormatter
$message->setAdditional($this->contextPrefix . $key, is_scalar($val) ? $val : $this->toJson($val));
}
if (null === $message->getFile() && isset($record['context']['exception'])) {
if (preg_match("/^(.+):([0-9]+)$/", $record['context']['exception']['file'], $matches)) {
$message->setFile($matches[1]);
$message->setLine($matches[2]);
}
}
return $message;
}
}