mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-17 18:36:32 +02:00
Used the line and file in the FirePHP message
This commit is contained in:
@@ -17,6 +17,7 @@ use Monolog\Logger;
|
|||||||
* Serializes a log message according to Wildfire's header requirements
|
* Serializes a log message according to Wildfire's header requirements
|
||||||
*
|
*
|
||||||
* @author Eric Clemmons (@ericclemmons) <eric@uxdriven.com>
|
* @author Eric Clemmons (@ericclemmons) <eric@uxdriven.com>
|
||||||
|
* @author Christophe Coevoet <stof@notk.org>
|
||||||
*/
|
*/
|
||||||
class WildfireFormatter extends LineFormatter
|
class WildfireFormatter extends LineFormatter
|
||||||
{
|
{
|
||||||
@@ -42,15 +43,26 @@ class WildfireFormatter extends LineFormatter
|
|||||||
*/
|
*/
|
||||||
public function format(array $record)
|
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
|
// Format record according with LineFormatter
|
||||||
$message = parent::format($record);
|
$message = parent::format($record);
|
||||||
|
|
||||||
// Create JSON object describing the appearance of the message in the console
|
// Create JSON object describing the appearance of the message in the console
|
||||||
$json = json_encode(array(
|
$json = json_encode(array(
|
||||||
array(
|
array(
|
||||||
'Type' => $this->logLevels[$record['level']],
|
'Type' => $this->logLevels[$record['level']],
|
||||||
'File' => '',
|
'File' => $file,
|
||||||
'Line' => '',
|
'Line' => $line,
|
||||||
'Label' => $record['channel'],
|
'Label' => $record['channel'],
|
||||||
),
|
),
|
||||||
$message,
|
$message,
|
||||||
|
Reference in New Issue
Block a user