Skip to content

Instantly share code, notes, and snippets.

@Gimcrack
Created August 25, 2020 23:32
Show Gist options
  • Save Gimcrack/3a6cbf5ec78768229bedbbd28cd75a74 to your computer and use it in GitHub Desktop.
Save Gimcrack/3a6cbf5ec78768229bedbbd28cd75a74 to your computer and use it in GitHub Desktop.
Papertrail Log Formatter
<?php
namespace App\Exceptions;
use Monolog\Formatter\LineFormatter;
class PapertrailFormatter extends LineFormatter {
public const SIMPLE_FORMAT = "%channel%.%level_name%: %message% %context% %extra%\n";
public function includeStacktraces(bool $include = true)
{
$this->includeStacktraces = false;
}
public function allowInlineLineBreaks(bool $allow = true)
{
$this->allowInlineLineBreaks = true;
}
public function format(array $record): string
{
return "[" . config('app.name') . "]." . parent::format($record);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment