Files
cycle_api/app/Tools/Logs.php
2024-03-27 00:11:26 +08:00

31 lines
666 B
PHP

<?php
namespace App\Tools;
use Illuminate\Support\Facades\Log;
class Logs
{
static function ErrLog($title, \Exception $e, $params = []): void
{
Log::error(self::getTitle($title,'error:'), ['message' => $e->getMessage(), 'trace' => $e->getTrace(), 'params' => $params]);
}
static function SuccLog($title, $params = []): void
{
Log::error(self::getTitle($title,'success:'), $params);
}
static function InfoLog($title, $params = []): void
{
Log::error(self::getTitle($title,'info:'), $params);
}
static function getTitle($title,$prefix=''): string
{
return $title.' '.$prefix;
}
}