LogService.php 440 B

12345678910111213141516171819
  1. <?php
  2. namespace App\Services;
  3. use Exception;
  4. use Illuminate\Support\Facades\Log;
  5. class LogService
  6. {
  7. public static function error(Exception $e): void
  8. {
  9. $errorText = "\n---------------错误信息---------------\n";
  10. $errorText .= "File:{$e->getFile()}\n";
  11. $errorText .= "Link:{$e->getLine()}\n";
  12. $errorText .= $e->getMessage();
  13. $errorText .= "\n";
  14. Log::error($errorText);
  15. }
  16. }