mirror of
https://github.com/Seldaek/monolog.git
synced 2025-02-24 15:02:28 +01:00
Used the line and file in the FirePHP message
This commit is contained in:
parent
f93d6f0837
commit
9b2a64d64f
@ -17,6 +17,7 @@ use Monolog\Logger;
|
||||
* Serializes a log message according to Wildfire's header requirements
|
||||
*
|
||||
* @author Eric Clemmons (@ericclemmons) <eric@uxdriven.com>
|
||||
* @author Christophe Coevoet <stof@notk.org>
|
||||
*/
|
||||
class WildfireFormatter extends LineFormatter
|
||||
{
|
||||
@ -42,6 +43,17 @@ class WildfireFormatter extends LineFormatter
|
||||
*/
|
||||
public function format(array $record)
|
||||
{
|
||||
// Retrieve the line and file if set and remove them from the formatted extra
|
||||
$file = $line = '';
|
||||
if (isset($record['extra']['file'])) {
|
||||
$file = $record['extra']['file'];
|
||||
unset($record['extra']['file']);
|
||||
}
|
||||
if (isset($record['extra']['line'])) {
|
||||
$line = $record['extra']['line'];
|
||||
unset($record['extra']['line']);
|
||||
}
|
||||
|
||||
// Format record according with LineFormatter
|
||||
$message = parent::format($record);
|
||||
|
||||
@ -49,8 +61,8 @@ class WildfireFormatter extends LineFormatter
|
||||
$json = json_encode(array(
|
||||
array(
|
||||
'Type' => $this->logLevels[$record['level']],
|
||||
'File' => '',
|
||||
'Line' => '',
|
||||
'File' => $file,
|
||||
'Line' => $line,
|
||||
'Label' => $record['channel'],
|
||||
),
|
||||
$message,
|
||||
|
Loading…
x
Reference in New Issue
Block a user